in reply to Re: Re^5: Get rid of the Indirect Syntax, please!
in thread On the Improvement of Exegesis 12

why would it be omittable in the single-argument (and possibly others) case, but not in all cases?

Again - I've only skimmed A12 so I am probably wrong :-) However, consider:

bar $foo, 1;

Does this mean:

($foo.bar), 1

or:

$foo.bar( 1 );

The colon disambiguates it:

bar $foo: 1 == $foo.bar( 1 ); bar $foo, 1 == ($foo.bar), 1;

Replies are listed 'Best First'.
Re: Re^7: Get rid of the Indirect Syntax, please!
by dragonchild (Archbishop) on Apr 19, 2004 at 15:24 UTC
    If you're writing that, you're crazy. But, if you wanted to do that, then you are probably going to have written some crazy multimethod signature which will disambiguate. And, if the parser can't deal with it, your maintainer sure as heck won't be able to deal with it.

    The colon disambiguates it:

    And, to this statement, I can only say "Parentheses should be disambiguating it". If you're depending on a colon, which is on the same key as the semi-colon (the most-used character in C-type languages, I might add) ... I have the same feeling about this as I do about an organization who knows its database schema is bad, but refuses to stop new development. *shrugs*

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

      I can only say "Parentheses should be disambiguating it".

      Well, parentheses can't always disambiguate, because you can have multiple invocants. For example:

      some_method($obj1, $obj2:); some_method($obj1: $obj2);
      (I'm not 100% sure on the syntax.) Multiple dispatch decides which method to call based on the types of all invocants. Usually you only have one, but you can have more than one if you want more than one object to be considered when the dispatcher is deciding which method to call. In those cases, you really need the indirect syntax.

      Update: This is wrong. I got mixed up between declaration and call. You can declare a method to have more than one argument involved in the dispatch decision, but you can't (per Larry below) call it that way.

        That's not how I read A12. I understood it to be similar to C++ method overloading, where dispatch will determine which method(s) have the bester fit for a given signature based on the first N arguments (or somesuch), regardless of invocant-ness. But, I think we're extremely heavy off the speculation deep-end. Larry?!?

        ------
        We are the carpenters and bricklayers of the Information Age.

        Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose