Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Perl6 dot syntax (for methods?)

by PodMaster (Abbot)
on Feb 28, 2005 at 06:29 UTC ( #434978=note: print w/replies, xml ) Need Help??


in reply to Perl6 dot syntax (for methods?)

example it seems to be okay to use it for normal function calls as well
normal function calls? No, you're thinking of "indirect object" notation. Basically @array is an object (everything is an object) ... read about it in Apocalypse 12: Objects

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^2: Perl6 dot syntax (for methods?)
by Thilosophy (Curate) on Feb 28, 2005 at 07:05 UTC
    Basically @array is an object (everything is an object).

    Oh my, now I am getting even more confused...

    (1, 5, 2, 4, 3).quicksort.say;

    So, quicksort and say are methods of the array class? Or of the base object class? Because if they are not, I think the normal functional syntax is more appropriate. Especially if everything is (or can be treated as) an object, should we not be extra careful about what really is a method and what is not?

      They are methods of the list class, at least here, at least as far as I understand it.

      My understanding is also that the operator forms multi-dispatch to the appropriate methods according to their arguments.

      FWIW, you can do this sort of thing in Perl5 as well; see autobox.
      So, quicksort and say are methods of the array class? Or of the base object class?

      I think both of them are methods of the array abstract base class. I mean, similar semantics and syntax is pretty common, and very familiar in other scripting languages. At least, Python does this:

      >>> q=[2,3] >>> p=[1,q,3] >>> p[1].append('xtra') >>> p [1, [2, 3, 'xtra'], 3]

      rg0now

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2019-08-20 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?