Would You Miss Autoderef in 5.20?

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.)

Modern Perl: The Book

cover image for Modern Perl: the book

The best Perl Programmers read Modern Perl: The Book.

affiliated with Modern Perl Whitepapers



About this Entry

This page contains a single entry by chromatic published on November 1, 2013 6:00 AM.

Pragmatic Perl Interview (English Translation) was the previous entry in this blog.

Mojolicious Unicode Normalization Plugin Released is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by the Perl programming language

what is programming?