Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^6: Autoboxing ... "Yes We Can" ( or how I learned to love TIMTOWTDI )

by educated_foo (Vicar)
on Dec 17, 2013 at 04:17 UTC ( [id://1067421]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Autoboxing ... "Yes We Can" ( or how I learned to love TIMTOWTDI )
in thread Autoboxing ... "Yes We Can" ( or how I learned to love TIMTOWTDI ;)

multimethods?
Just some more terminology. A "method" is &{lookup($x, 'name')}($x, ...). A "multimethod" is just &{lookup($x, ..., 'name')}($x, ...)).
one of the peculiar sides of Perl is that plenty of build-ins internally work on references and but force you to dereference the argument manually.
each() *once* only worked on hashes, so it could complain at compile-time. Now it not only works on hashes and hash-refs, but also on arrays and array-refs, so if it gets a reference, it has to either guess (i.e. DWIM) or, in the current implementation, complain and refuse to do anything useful (i.e. "Type of argument to each on reference must be unblessed hashref or arrayref").

Replies are listed 'Best First'.
Re^7: Autoboxing ... "Yes We Can" ( or how I learned to love TIMTOWTDI )
by LanX (Saint) on Dec 17, 2013 at 07:48 UTC
    > each()  once only worked on hashes,

    true, never thought about it, but each can handle such problems only at runtime now.

    So do you like or dislike it?

    I mean, we could drop the new behavior in favor of method-calls on scalars... ;-)

    update

    oh just noticed again, you alread said

    > no problem with auto-deref.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-19 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found