in reply to Re: Reference is experimental
in thread Reference is experimental

I don't believe that postfix-deref was a replacement for shifting an aref... it's just a different way to dereference references.

The problem here is that $tmp[0] is a scalar, and back in the days where shifting refs was experimental, it assumed that anything not an array should be a reference to one.

As you've said, that experiment ended, and in 5.24.0+, we now get something a little different and descriptive (albeit still with an experimental warning):

perl -wMstrict -E 'my @a=(1); shift $a[0]' Experimental shift on scalar is now forbidden at -e line 1, at EOF Execution of -e aborted due to compilation errors.

Replies are listed 'Best First'.
Re^3: Reference is experimental
by ikegami (Patriarch) on Oct 20, 2016 at 18:26 UTC

    The experimental feature was abandoned for the operators that work on both hashes and arrays (keys, values and each) because the design couldn't work properly for all array-like and hash-like things.

    The same problem didn't exist for the operators that work solely on arrays (push, pop, shift, unshift and splice(?)), but the feature was also abandoned for them to avoid a lack of symmetry with keys, values and each. However, it's worth noting that it was mentioned that newly-created postderef lessened the need for these.

      However, it's worth noting that it was mentioned that newly-created postderef lessened the need for these.

      It would be interesting to ask whether there was ever any real requirement for either?

      Or was this just a flight of fancy by some dev overeager to leave fingerprints on the codebase, approved on the basis of who was proposing it, rather than a proper technical assessment of the need for, utility of, and "fit" of the proposal.