diff options
author | Aaron Crane <arc@cpan.org> | 2015-06-11 13:26:53 +0100 |
---|---|---|
committer | Aaron Crane <arc@cpan.org> | 2015-06-27 20:39:54 +0100 |
commit | 2ad792cd4e9684519736fe03fd28a706b71ceda3 (patch) | |
tree | 0e1c101e674ab7b6d9ce906b36f991ea46f07729 | |
parent | e7b6553ad4b9659368147bbbeb7b10a6e141288b (diff) | |
download | perl-2ad792cd4e9684519736fe03fd28a706b71ceda3.tar.gz |
The postderef feature is no longer experimental
As proposed by RJBS.
The "5.24" feature bundle (and therefore C<< use v5.24 >>) now enable
postderef and postderef_qq.
I can't find any precedent for what to do with the relevant experimental::*
warnings category when an experimental feature graduates to acceptance. I
have elected to leave the category in place, so that code doing C<< no
warnings "experimental::postderef" >> will continue to work. This means that
C<< use warnings "experimental::postderef" >> is also accepted, but has no
effect.
-rw-r--r-- | feature.h | 34 | ||||
-rw-r--r-- | lib/feature.pm | 26 | ||||
-rw-r--r-- | lib/overload.t | 1 | ||||
-rw-r--r-- | pod/perldelta.pod | 6 | ||||
-rw-r--r-- | pod/perldiag.pod | 15 | ||||
-rw-r--r-- | pod/perlexperiment.pod | 16 | ||||
-rw-r--r-- | pod/perlop.pod | 2 | ||||
-rw-r--r-- | pod/perlref.pod | 4 | ||||
-rwxr-xr-x | regen/feature.pl | 21 | ||||
-rw-r--r-- | t/lib/warnings/toke | 2 | ||||
-rw-r--r-- | t/op/postfixderef.t | 1 | ||||
-rw-r--r-- | toke.c | 4 |
12 files changed, 61 insertions, 71 deletions
@@ -13,6 +13,7 @@ #define FEATURE_BUNDLE_510 1 #define FEATURE_BUNDLE_511 2 #define FEATURE_BUNDLE_515 3 +#define FEATURE_BUNDLE_523 4 #define FEATURE_BUNDLE_CUSTOM (HINT_FEATURE_MASK >> HINT_FEATURE_SHIFT) #define CURRENT_HINTS \ @@ -31,7 +32,8 @@ #define FEATURE_FC_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \ + (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_523) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("fc")) \ ) @@ -39,7 +41,7 @@ #define FEATURE_SAY_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_515) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_523) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("say")) \ ) @@ -47,7 +49,7 @@ #define FEATURE_STATE_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_515) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_523) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("state")) \ ) @@ -55,7 +57,7 @@ #define FEATURE_SWITCH_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_515) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_523) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("switch")) \ ) @@ -68,15 +70,17 @@ #define FEATURE_EVALBYTES_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \ + (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_523) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("evalbytes")) \ ) #define FEATURE_POSTDEREF_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ - FEATURE_IS_ENABLED("postderef") \ + CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_523 \ + || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ + FEATURE_IS_ENABLED("postderef")) \ ) #define FEATURE_ARYBASE_IS_ENABLED \ @@ -94,7 +98,8 @@ #define FEATURE___SUB___IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \ + (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_523) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("__SUB__")) \ ) @@ -113,13 +118,15 @@ #define FEATURE_POSTDEREF_QQ_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ - FEATURE_IS_ENABLED("postderef_qq") \ + CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_523 \ + || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ + FEATURE_IS_ENABLED("postderef_qq")) \ ) #define FEATURE_UNIEVAL_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \ + (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_523) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("unieval")) \ ) @@ -127,7 +134,7 @@ #define FEATURE_UNICODE_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_511 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_515) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_523) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("unicode")) \ ) @@ -142,6 +149,9 @@ S_enable_feature_bundle(pTHX_ SV *ver) SV *comp_ver = sv_newmortal(); PL_hints = (PL_hints &~ HINT_FEATURE_MASK) | ( + (sv_setnv(comp_ver, 5.023), + vcmp(ver, upg_version(comp_ver, FALSE)) >= 0) + ? FEATURE_BUNDLE_523 : (sv_setnv(comp_ver, 5.015), vcmp(ver, upg_version(comp_ver, FALSE)) >= 0) ? FEATURE_BUNDLE_515 : diff --git a/lib/feature.pm b/lib/feature.pm index 4cf11a79da..e2076ed8a6 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -5,7 +5,7 @@ package feature; -our $VERSION = '1.41'; +our $VERSION = '1.42'; our %feature = ( fc => 'feature_fc', @@ -29,6 +29,7 @@ our %feature_bundle = ( "5.10" => [qw(array_base say state switch)], "5.11" => [qw(array_base say state switch unicode_strings)], "5.15" => [qw(current_sub evalbytes fc say state switch unicode_eval unicode_strings)], + "5.23" => [qw(current_sub evalbytes fc postderef postderef_qq say state switch unicode_eval unicode_strings)], "all" => [qw(array_base bitwise current_sub evalbytes fc lexical_subs postderef postderef_qq refaliasing say signatures state switch unicode_eval unicode_strings)], "default" => [qw(array_base)], ); @@ -43,13 +44,12 @@ $feature_bundle{"5.19"} = $feature_bundle{"5.15"}; $feature_bundle{"5.20"} = $feature_bundle{"5.15"}; $feature_bundle{"5.21"} = $feature_bundle{"5.15"}; $feature_bundle{"5.22"} = $feature_bundle{"5.15"}; -$feature_bundle{"5.23"} = $feature_bundle{"5.15"}; -$feature_bundle{"5.24"} = $feature_bundle{"5.15"}; +$feature_bundle{"5.24"} = $feature_bundle{"5.23"}; $feature_bundle{"5.9.5"} = $feature_bundle{"5.10"}; our $hint_shift = 26; our $hint_mask = 0x1c000000; -our @hint_bundles = qw( default 5.10 5.11 5.15 ); +our @hint_bundles = qw( default 5.10 5.11 5.15 5.23 ); # This gets set (for now) in $^H as well as in %^H, # for runtime speed of the uc/lc/ucfirst/lcfirst functions. @@ -260,13 +260,6 @@ This feature is available from Perl 5.18 onwards. =head2 The 'postderef' and 'postderef_qq' features -B<WARNING>: This feature is still experimental and the implementation may -change in future versions of Perl. For this reason, Perl will -warn when you use the feature, unless you have explicitly disabled the -warning: - - no warnings "experimental::postderef"; - The 'postderef' feature allows the use of L<postfix dereference syntax|perlref/Postfix Dereference Syntax>. For example, it will make the following two statements equivalent: @@ -277,7 +270,15 @@ following two statements equivalent: The 'postderef_qq' feature extends this, for array and scalar dereference, to working inside of double-quotish interpolations. -This feature is available from Perl 5.20 onwards. +These features are available from Perl 5.20 onwards. In Perl 5.20 and 5.22, +they were classed as experimental, and Perl emitted a warning for their +usage, except when explicitly disabled: + + no warnings "experimental::postderef"; + +As of Perl 5.24, use of these features no longer triggers a warning, though +the C<experimental::postderef> warning category still exists (for +compatibility with code that disables it). =head2 The 'signatures' feature @@ -374,6 +375,7 @@ The following feature bundles are available: :5.24 say state switch unicode_strings unicode_eval evalbytes current_sub fc + postderef postderef_qq The C<:default> bundle represents the feature set that is enabled before any C<use feature> or C<no feature> declaration. diff --git a/lib/overload.t b/lib/overload.t index e6f4062932..ef4ce4e593 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -2739,7 +2739,6 @@ package refsgalore { } { use feature 'postderef'; - no warnings 'experimental::postderef'; tell myio; # vivifies *myio{IO} at compile time use constant ioref => bless *myio{IO}, refsgalore::; is ioref->$*, 42, '(overloaded constant that is not a scalar ref)->$*'; diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 58ece4a384..c31893fdb3 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -16,6 +16,12 @@ release. For details on what is in this release, see L<http://www.unicode.org/versions/Unicode8.0.0/>. +=head2 Postfix dereferencing is no longer experimental + +Using the C<postderef> and C<postderef_qq> features no longer emits a warning. +Existing code that disables that warning category will continue to work. The +C<5.24> feature bundle now includes those features. + =head1 Incompatible Changes =head2 The C</\C/> character class has been removed. diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 558fd62428..9d048cfda5 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -4748,21 +4748,6 @@ but there was no array C<@foo> in scope at the time. If you wanted a literal @foo, then write it as \@foo; otherwise find out what happened to the array you apparently lost track of. -=item Postfix dereference is experimental - -(S experimental::postderef) This warning is emitted if you use -the experimental postfix dereference syntax. Simply suppress the -warning if you want to use the feature, but know that in doing -so you are taking the risk of using an experimental feature which -may change or be removed in a future Perl version: - - no warnings "experimental::postderef"; - use feature "postderef", "postderef_qq"; - $ref->$*; - $aref->@*; - $aref->@[@indices]; - ... etc ... - =item Precedence problem: open %s should be open(%s) (S precedence) The old irregular construct diff --git a/pod/perlexperiment.pod b/pod/perlexperiment.pod index 1e7dd27c67..f670147631 100644 --- a/pod/perlexperiment.pod +++ b/pod/perlexperiment.pod @@ -97,16 +97,6 @@ C<experimental::signatures>. The ticket for this feature is L<[perl #121481]|https://rt.perl.org/Ticket/Display.html?id=121481>. -=item Postfix dereference syntax - -Introduced in Perl 5.20.0 - -Using this feature triggers warnings in the category -C<experimental::postderef>. - -The ticket for this feature is -L<[perl #120162]|https://rt.perl.org:443/rt3/Ticket/Display.html?id=120162>. - =item Aliasing via reference Introduced in Perl 5.22.0 @@ -270,6 +260,12 @@ Accepted in Perl 5.20.0 Accepted in Perl 5.22.0 +=item Postfix dereference syntax + +Introduced in Perl 5.20.0 + +Accepted in Perl 5.24.0 + =back =head2 Removed features diff --git a/pod/perlop.pod b/pod/perlop.pod index 018698e89c..d47bcb66e6 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -154,7 +154,7 @@ and the left side must be either an object (a blessed reference) or a class name (that is, a package name). See L<perlobj>. The dereferencing cases (as opposed to method-calling cases) are -somewhat extended by the experimental C<postderef> feature. For the +somewhat extended by the C<postderef> feature. For the details of that feature, consult L<perlref/Postfix Dereference Syntax>. =head2 Auto-increment and Auto-decrement diff --git a/pod/perlref.pod b/pod/perlref.pod index 86ecfdd404..8956be5750 100644 --- a/pod/perlref.pod +++ b/pod/perlref.pod @@ -758,9 +758,7 @@ For example: $r = [ 1, [ 2, 3 ], 4 ]; $r->[1]->@*; # equivalent to @{ $r->[1] } -This syntax must be enabled with C<use feature 'postderef'>. It is -experimental, and will warn by default unless C<no warnings -'experimental::postderef'> is in effect. +This syntax must be enabled with C<use feature 'postderef'>. Postfix dereference should work in all circumstances where block (circumfix) dereference worked, and should be entirely equivalent. This diff --git a/regen/feature.pl b/regen/feature.pl index 115c5a5c32..48363041f4 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -60,7 +60,7 @@ my %feature_bundle = ( "5.21" => [qw(say state switch unicode_strings unicode_eval evalbytes current_sub fc)], "5.23" => [qw(say state switch unicode_strings unicode_eval - evalbytes current_sub fc)], + evalbytes current_sub fc postderef postderef_qq)], ); # not actually used currently @@ -367,7 +367,7 @@ read_only_bottom_close_and_rename($h); __END__ package feature; -our $VERSION = '1.41'; +our $VERSION = '1.42'; FEATURES @@ -575,13 +575,6 @@ This feature is available from Perl 5.18 onwards. =head2 The 'postderef' and 'postderef_qq' features -B<WARNING>: This feature is still experimental and the implementation may -change in future versions of Perl. For this reason, Perl will -warn when you use the feature, unless you have explicitly disabled the -warning: - - no warnings "experimental::postderef"; - The 'postderef' feature allows the use of L<postfix dereference syntax|perlref/Postfix Dereference Syntax>. For example, it will make the following two statements equivalent: @@ -592,7 +585,15 @@ following two statements equivalent: The 'postderef_qq' feature extends this, for array and scalar dereference, to working inside of double-quotish interpolations. -This feature is available from Perl 5.20 onwards. +These features are available from Perl 5.20 onwards. In Perl 5.20 and 5.22, +they were classed as experimental, and Perl emitted a warning for their +usage, except when explicitly disabled: + + no warnings "experimental::postderef"; + +As of Perl 5.24, use of these features no longer triggers a warning, though +the C<experimental::postderef> warning category still exists (for +compatibility with code that disables it). =head2 The 'signatures' feature diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index dab8451484..d65467c218 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -1047,8 +1047,6 @@ no warnings 'experimental::postderef'; (\$_)->$*; "$_->$*"; EXPECT -Postfix dereference is experimental at - line 3. -Postfix dereference is experimental at - line 4. ######## # toke.c use warnings 'portable' ; diff --git a/t/op/postfixderef.t b/t/op/postfixderef.t index 79b66dea4b..920bc2db23 100644 --- a/t/op/postfixderef.t +++ b/t/op/postfixderef.t @@ -43,7 +43,6 @@ plan(125); } use feature 'postderef'; -no warnings 'experimental::postderef'; { no strict 'refs'; @@ -5140,10 +5140,6 @@ Perl_yylex(pTHX) ||(*s == '*' && (s[1] == '*' || s[1] == '{')) )) { - Perl_ck_warner_d(aTHX_ - packWARN(WARN_EXPERIMENTAL__POSTDEREF), - "Postfix dereference is experimental" - ); PL_expect = XPOSTDEREF; TOKEN(ARROW); } |