in reply to Re^2: Experimental push on scalar now forbidden
in thread Experimental push on scalar now forbidden

I did a bit of digging in the archives. I believe the original proposal for autoderef is this: perl #78656: Allow push/pop/keys/etc to act on references (this already contains a long discussion). The feature was introduced in v5.14 (documented as experimental, but standardized warnings for experimental features weren't added until later, Update: in v5.20).

This P5P thread appears to be one of the discussions about the problems with the feature: Bug in auto-dereferencing in 5.14? My understanding is that there were lots of small problems with it, some philosophical but several practical, that added up to this being a contentious feature. Just to pick out two examples, again just based on my understanding from skimming the discussions: First, given that each, keys, and values can operate on both hashes and arrays (since v5.12), what does $x autovivify to in my $x; keys $x;? Second, what about blessed references that overload their dereferencing operations?

Since part of the reasoning behind introducing autoderef was to make some expressions simpler (push @{$foo{bar}{quz}}, $x; became push $foo{bar}{quz}, $x;), i.e. getting rid of the need for circumfix @{} and %{} dereferencing, the Postfix Dereference Syntax that was first introduced in v5.20 took care of that particular point (push @{$foo{bar}{quz}}, $x; became push $foo{bar}{quz}->@*, $x;). It seems to me that the discussion then generally moved in the direction that the problematic autoderef could be removed in favor of postfix deref (e.g. perl #119437: autoderef, the implicit deref in push REF and others, the future of auto-deref), until that then happened in v5.24 together with postfix deref being taken out of experimental status as a replacement.

(Update: See also perlexperiment.)

Replies are listed 'Best First'.
Re^4: Experimental push on scalar now forbidden
by KurtZ (Friar) on May 21, 2017 at 21:03 UTC
    Thanks a lot, especially for the summary! :)
Re^4: Experimental push on scalar now forbidden
by stevieb (Canon) on May 21, 2017 at 21:13 UTC

    Very nice work haukex!

    Now that you mention it, I remember the whole auto-deref fiasco, and also recall having some long conversations about it now that you dug up the details.

    Nice work closing out this thread with such detail :)