Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Re^7: Get rid of the Indirect Syntax, please!

by kelan (Deacon)
on Apr 19, 2004 at 16:32 UTC ( #346335=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re11: Get rid of the Indirect Syntax, please!
by dragonchild (Archbishop) on Apr 19, 2004 at 16:58 UTC
    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

      I'm inclined to say that the caller isn't allowed to say how many of the args are invocants. It's either single dispatch or multiple dispatch (with the fuzzy area in the middle for argumentless calls).
        And am I correct in saying that dispatch will happen based on the argument types, regardless of bless'edness? Meaning, I could do something like foo($bar, 1, 2) and end up calling, essentially, $bar->foo(1, 2) under the covers?

        ------
        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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://346335]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2022-10-05 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (21 votes). Check out past polls.

    Notices?