Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Perl6 dot syntax (for methods?)

by Thilosophy (Curate)
on Feb 28, 2005 at 07:05 UTC ( #434985=note: print w/replies, xml ) Need Help??


in reply to Re: Perl6 dot syntax (for methods?)
in thread Perl6 dot syntax (for methods?)

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?

Replies are listed 'Best First'.
Re^3: Perl6 dot syntax (for methods?)
by chromatic (Archbishop) on Feb 28, 2005 at 07:46 UTC

    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.

Re^3: Perl6 dot syntax (for methods?)
by gaal (Parson) on Feb 28, 2005 at 07:37 UTC
    FWIW, you can do this sort of thing in Perl5 as well; see autobox.
Re^3: Perl6 dot syntax (for methods?)
by rg0now (Chaplain) on Feb 28, 2005 at 13:50 UTC
    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://434985]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2019-02-22 06:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I use postfix dereferencing ...









    Results (115 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!