Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Is auto-dereferencing worth forcing upgrades to newer versions of Perl?

by tobyink (Canon)
on Aug 15, 2013 at 13:49 UTC ( [id://1049591]=note: print w/replies, xml ) Need Help??


in reply to Is auto-dereferencing worth forcing upgrades to newer versions of Perl?

There are plenty of good features that are worth upgrading for in 5.14, but this is not one of them.

Even when writing code that requires Perl 5.14, I avoid this new feature, preferring to use an explicit @{} dereference operation.

As chromatic has pointed out before, when combined with the fact that Perl 5.12 allows each, keys and values to work on arrays like they do on hashes, this feature introduces ambiguities. (What happens in blessed arrayrefs which overload hashrefification? Or blessed hashrefs which overload arrayfication? Or blessed scalar refs which overload both?!)

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Replies are listed 'Best First'.
Re^2: Is auto-dereferencing worth forcing upgrades to newer versions of Perl?
by tinita (Parson) on Aug 20, 2013 at 11:38 UTC
    (What happens in blessed arrayrefs which overload hashrefification? Or blessed hashrefs which overload arrayfication? Or blessed scalar refs which overload both?!)
    push $blessed_hashref_or_arrayref, ...
    results in:
    "Not an ARRAY reference" or
    "Not an unblessed ARRAY reference"

    each $blessed_hashref_or_arrayref
    results in:
    "Type of argument to each on reference must be unblessed hashref or arrayref"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found