LanX has asked for the wisdom of the Perl Monks concerning the following question:

the core° pragma experimental says

The supported features, documented further below, are:

array_base - allow the use of $[ to change the starting index of @array autoderef - allow push, each, keys, and other built-ins on references lexical_topic - allow the use of lexical $_ via "my $_"

Though running the following code under 5.24 doesn't show any effect

use strict; use warnings; use experimental 'autoderef'; BEGIN { warn "@INC\n"; warn "$]\n"; } my $a=[]; push $a,1,2,3; warn "@$a";

out

c:/Perl_524/bin/\perl.exe d:/Users/RolfLangsdorf/AppData/Roaming/pm/e +xperimental_autoderef.pl c:/Perl_524/site/lib c:/Perl_524/lib . 5.024001 Experimental push on scalar is now forbidden at d:/Users/RolfLangsdorf +/AppData/Roaming/pm/experimental_autoderef.pl line 13, near "3;" Execution of d:/Users/RolfLangsdorf/AppData/Roaming/pm/experimental_au +toderef.pl aborted due to compilation errors.

I suppose this is a bug, though I'm wondering was there ever a useful application for

use experimental 'autoderef'; ?

AFAIK autoderef never needed to be activated.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

°) strange

~/pm $ corelist experimental Data for ????-??-?? experimental was first released with perl v5.19.11

but perldoc.perl.org doesn't list experimental

update

I know that auto deref was deprecated, but the mention in experimental doesn't make sense, because

That's very confusing

Replies are listed 'Best First'.
Re: use experimental 'autoderef'; ???
by Haarg (Priest) on Jun 29, 2017 at 05:16 UTC

    experimental.pm handles both enabling features via feature.pm and disabling the experimental warnings for them. The features it supports aren't the exact same features as exist in feature.pm. Some of the things it supports don't need to be enabled, but do issue warnings. And some things do need to be enabled but didn't issue warnings on older versions of perl. experimental.pm is also a dual-life module, so it supports some features even though the perl it ships with no longer supports them. That should probably be more clear in the documentation.

    autoderef never needed to be enabled, but it did issue warnings in perl 5.20 and 5.22. There is a bug here though. It should be throwing an error if you request autoderef on a newer perl, rather than silently doing nothing. I've filed a bug for this.

Re: use experimental 'autoderef'; ???
by choroba (Cardinal) on Jun 29, 2017 at 09:55 UTC
    See also auto-deref in Syntax::Construct. It lists the construct as "removed" in 5.24, and it works correctly:
    $ blead perl -MSyntax::Construct=auto-deref -e1 Faking version 5.028 to test removed constructs. auto-deref removed in 5.024 at -e line 0 at .../Syntax/Construct.pm li +ne 125. BEGIN failed--compilation aborted. [[err: 255]]

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re: use experimental 'autoderef'; ???
by stevieb (Canon) on Jun 29, 2017 at 00:08 UTC

    Looks like a doc bug:

    perl -v This is perl 5, version 24, subversion 1 (v5.24.1)

    On the CLI:

    perldoc experimental

    After searching for "autoderef":

    The supported features, documented further below, are: array_base - allow the use of $[ to change the starting index of @ +array autoderef - allow push, each, keys, and other built-ins on refere +nces ...

    Online, however, searching for "perldoc experiment" (resulting doc: experiment):

    Array and hash container functions accept references Using this feature triggered warnings in the category experimental::au +toderef . Superseded by Postfix dereference syntax. Introduced in Perl 5.14.0 Removed in Perl 5.24.0

    There was definitely a good long period where autoderef was in play, but there was the postderef camp as well. The fight was won by the postderef camp. It was a drawn out ordeal ;)

    update: I may be missing what you're getting at here, but either way, something doesn't line up.

    updte2: Since it was so long ago, I don't recall the arguments on each side I had, but iirc, postderef was better for longevity, but I'm still old-school. I write all of my code so it runs on 5.8.9... no magic for me.

      I don't recall the arguments on each side

      There are probably many more arguments for both sides, but I remember reading somewhere that one of the reasons postderef won is that some of the function concerned by the autoderef feature work on either hashes or arrays. So with each $hash{THING};, if %hash is empty, the target of each could either be autovivified into a hash or an array, or this could throw an error. But there's also keys $obj; where $obj can overload the dereferencing operators @{} and %{} and perl would have to choose which one to call (or again, throw an error). each $hash{RUD}->@* or each $obj->%* leaves no such ambiguity.

      There was definitely a good long period where autoderef was in play, but there was the postderef camp as well. The fight was won by the postderef camp. It was a drawn out ordeal ;)

      Both camps should die in fire.

Re: use experimental 'autoderef'; ???
by fishmonger (Chaplain) on Jun 29, 2017 at 00:21 UTC

    Earlier today I watched a youtube video on one of Sawyer's talks ("Perl 5.26 and the Blue-Blue Shiny Ball of Eternal Transparency") from last weeks YAPC conference which touched on experimental 'autoderef' unfortunately I don't recall the details but it might answer your question.

    https://www.youtube.com/watch?v=SYmdef_WQsw