In Perl 5.13 (the development track for Perl 5.14), the experimental feature called "autoderef" appeared. The short description from perl5140delta reads:
Array and hash container functions accept references
In other words, given a hash reference $hash
or an array
reference $array
, you can write @keys = keys $hash
or
push $array, $value
and Perl will happily interpret
$hash
as %$hash
and $array
as
@$array
.
Again, this feature was marked as experimental. It's not terribly risky,
except that autoderef
interferes with enhanced each
.
Perl 5.19 (the development track for Perl 5.20) has a new experimental feature called "postfix dereferencing". I don't have an opinion worth sharing yet, as I haven't thought about it to my satisfaction. Pumpking Ricardo Signes seems to like the feature a lot, which is a positive vote for it.
Today he sent a public thought to p5p about the combination of these two features, asking "With postfix deref in, is auto-deref still valuable?".
I admit that I haven't used autoderef much. Perl 5.14 is as old a version of Perl as I want to target (and I'd rather use 5.18 for full Unicode powers, but could live with 5.16 in a pinch), but the awkwardness of the combination of aggregate operators and aggregate autoderef makes me nervous.
Would you miss autoderef if it were gone? Would postfix deref make up for it?
(Later in the thread, Rafael Garcia-Suarez makes an interesting suggestion:
get rid of autoderef on the polymorphic container operators. That removes one
consistency—some container operators autoderef and others don't—but
it removes a larger inconsistency. In an ideal world, each
for
arrays would be arrayeach
and keys
and
values
and so forth would be monomorphic, but that's probably
never going to happen.)