In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/a50cb9d2d06ab72d549eaebb8b648f4dbe054a3d?hp=738155d2fb1d2430e97c38da93d074e4e8b5974f>

- Log -----------------------------------------------------------------
commit a50cb9d2d06ab72d549eaebb8b648f4dbe054a3d
Merge: 738155d db62956
Author: Father Chrysostomos <[email protected]>
Date:   Fri May 20 16:00:09 2016 -0700

    [Merge] Lexical subs are no longer experimental

commit db629560b69530994e144a9d538421f72ec29483
Author: Father Chrysostomos <[email protected]>
Date:   Fri May 20 14:30:14 2016 -0700

    Give feature.pm the concept of no-op features

M       feature.h
M       lib/B/Deparse.t
M       lib/feature.pm
M       regen/feature.pl

commit c2c360591864547f4210a9df74e0064cff39a11b
Author: Father Chrysostomos <[email protected]>
Date:   Fri May 20 14:17:55 2016 -0700

    Remove @experimental from regen/feature.pl
    
    Originally, we were going to have feature.pm warning when enabling
    an experimental feature.  That changed, though, when we introduced
    the :all tag, because it is unkind for :all to warn.  So in
    v5.17.6-49-g64fbf0d we started warning when a feature is used,
    not enabled.
    
    It does not appear that that will ever change, so we might as well
    remove the dead code (and comments) from regen/feature.pl.

M       regen/feature.pl

commit 06c4bad0551a71302ea93b2f015f632a62e48d76
Author: Father Chrysostomos <[email protected]>
Date:   Fri May 20 14:11:30 2016 -0700

    Update other docs on lexical sub acceptance

M       pod/perlexperiment.pod
M       pod/perlsub.pod

commit 32e7f215b3ed0d58db0abe1375ecbf0b202ddc43
Author: Father Chrysostomos <[email protected]>
Date:   Fri May 20 13:26:17 2016 -0700

    Increase $feature::VERSION to 1.44

M       lib/feature.pm
M       regen/feature.pl

commit 8f7d85af81a1d45acb4b5bdd3ef5636dccc8c6fb
Author: Father Chrysostomos <[email protected]>
Date:   Fri May 20 13:25:20 2016 -0700

    Update feature.pm docs for lex sub acceptance

M       lib/feature.pm
M       regen/feature.pl

commit 4be1619067a9654f65aef6cfd26153e246218fe8
Author: Father Chrysostomos <[email protected]>
Date:   Fri May 20 12:46:07 2016 -0700

    Update perldiag for lexsub diag removals

M       pod/perldiag.pod

commit 60e04ba1a34f784612d20e526a0ce38e47a53cf1
Author: Father Chrysostomos <[email protected]>
Date:   Fri May 20 12:45:10 2016 -0700

    Enable lex subs everywhere; suppress warning
    
    Adjust tests, too.

M       t/lib/croak/toke
M       t/lib/warnings/op
M       t/lib/warnings/toke
M       t/op/lexsub.t
M       toke.c
-----------------------------------------------------------------------

Summary of changes:
 feature.h              | 12 ------------
 lib/B/Deparse.t        | 10 +++-------
 lib/feature.pm         | 33 +++++++++++++++++++++------------
 pod/perldiag.pod       | 20 --------------------
 pod/perlexperiment.pod | 18 ++++++------------
 pod/perlsub.pod        | 23 +++++++----------------
 regen/feature.pl       | 36 ++++++++++++++++++++----------------
 t/lib/croak/toke       |  7 +------
 t/lib/warnings/op      |  4 ----
 t/lib/warnings/toke    |  5 +----
 t/op/lexsub.t          | 16 +---------------
 toke.c                 | 10 ----------
 12 files changed, 60 insertions(+), 134 deletions(-)

diff --git a/feature.h b/feature.h
index a527e06..27dfd51 100644
--- a/feature.h
+++ b/feature.h
@@ -76,12 +76,6 @@
         FEATURE_IS_ENABLED("evalbytes")) \
     )
 
-#define FEATURE_POSTDEREF_IS_ENABLED \
-    ( \
-       CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
-        FEATURE_IS_ENABLED("postderef") \
-    )
-
 #define FEATURE_ARYBASE_IS_ENABLED \
     ( \
        CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_511 \
@@ -109,12 +103,6 @@
         FEATURE_IS_ENABLED("refaliasing") \
     )
 
-#define FEATURE_LEXSUBS_IS_ENABLED \
-    ( \
-       CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
-        FEATURE_IS_ENABLED("lexsubs") \
-    )
-
 #define FEATURE_POSTDEREF_QQ_IS_ENABLED \
     ( \
        CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_523 \
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t
index 19db404..fe13aae 100644
--- a/lib/B/Deparse.t
+++ b/lib/B/Deparse.t
@@ -1941,12 +1941,11 @@ my($a, $b, $c) = @_;
 ####
 # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version"
 # lexical subroutine
-use feature 'lexical_subs';
+# CONTEXT use feature 'lexical_subs';
 no warnings "experimental::lexical_subs";
 my sub f {}
 print f();
 >>>>
-use feature 'lexical_subs';
 BEGIN {${^WARNING_BITS} = 
"\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x15"}
 my sub f {
     BEGIN {${^WARNING_BITS} = 
"\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"}
@@ -1957,20 +1956,17 @@ print f();
 ####
 # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version"
 # lexical "state" subroutine
-use feature 'state', 'lexical_subs';
+# CONTEXT use feature 'state', 'lexical_subs';
 no warnings 'experimental::lexical_subs';
 state sub f {}
 print f();
 >>>>
-use feature 'lexical_subs';
 BEGIN {${^WARNING_BITS} = 
"\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x15"}
-CORE::state sub f {
+state sub f {
     BEGIN {${^WARNING_BITS} = 
"\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"}
-    use feature 'state';
     
 }
 BEGIN {${^WARNING_BITS} = 
"\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"}
-use feature 'state';
 print f();
 ####
 # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version"
diff --git a/lib/feature.pm b/lib/feature.pm
index ede1022..caa7326 100644
--- a/lib/feature.pm
+++ b/lib/feature.pm
@@ -5,7 +5,7 @@
 
 package feature;
 
-our $VERSION = '1.43';
+our $VERSION = '1.44';
 
 our %feature = (
     fc              => 'feature_fc',
@@ -14,12 +14,10 @@ our %feature = (
     switch          => 'feature_switch',
     bitwise         => 'feature_bitwise',
     evalbytes       => 'feature_evalbytes',
-    postderef       => 'feature_postderef',
     array_base      => 'feature_arybase',
     signatures      => 'feature_signatures',
     current_sub     => 'feature___SUB__',
     refaliasing     => 'feature_refaliasing',
-    lexical_subs    => 'feature_lexsubs',
     postderef_qq    => 'feature_postderef_qq',
     unicode_eval    => 'feature_unieval',
     unicode_strings => 'feature_unicode',
@@ -30,7 +28,7 @@ our %feature_bundle = (
     "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_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)],
+    "all"     => [qw(array_base bitwise current_sub evalbytes fc postderef_qq 
refaliasing say signatures state switch unicode_eval unicode_strings)],
     "default" => [qw(array_base)],
 );
 
@@ -48,6 +46,10 @@ $feature_bundle{"5.24"} = $feature_bundle{"5.23"};
 $feature_bundle{"5.25"} = $feature_bundle{"5.23"};
 $feature_bundle{"5.26"} = $feature_bundle{"5.23"};
 $feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
+my %noops = (
+    postderef => 1,
+    lexical_subs => 1,
+);
 
 our $hint_shift   = 26;
 our $hint_mask    = 0x1c000000;
@@ -248,17 +250,21 @@ This feature is available from Perl 5.16 onwards.
 
 =head2 The 'lexical_subs' feature
 
-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:
+In Perl versions prior to 5.26, this feature enabled
+declaration of subroutines via C<my sub foo>, C<state sub foo>
+and C<our sub foo> syntax.  See L<perlsub/Lexical Subroutines> for details.
 
-    no warnings "experimental::lexical_subs";
+This feature is available from Perl 5.18 onwards.  From Perl 5.18 to 5.24,
+it was classed as experimental, and Perl emitted a warning for its
+usage, except when explicitly disabled:
 
-This enables declaration of subroutines via C<my sub foo>, C<state sub foo>
-and C<our sub foo> syntax.  See L<perlsub/Lexical Subroutines> for details.
+  no warnings "experimental::lexical_subs";
 
-This feature is available from Perl 5.18 onwards.
+As of Perl 5.26, use of this feature no longer triggers a warning, though
+the C<experimental::lexical_subs> warning category still exists (for
+compatibility with code that disables it).  In addition, this syntax is
+not only no longer experimental, but it is enabled for all Perl code,
+regardless of what feature declarations are in scope.
 
 =head2 The 'postderef' and 'postderef_qq' features
 
@@ -493,6 +499,9 @@ sub __common {
             next;
         }
         if (!exists $feature{$name}) {
+            if (exists $noops{$name}) {
+                next;
+            }
             unknown_feature($name);
         }
        if ($import) {
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 01f9e29..d0b5f25 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -2221,14 +2221,6 @@ has been removed.  The C<postderef> feature may meet 
your needs better.
     use feature "signatures";
     sub foo ($left, $right) { ... }
 
-=item Experimental "%s" subs not enabled
-
-(F) To use lexical subs, you must first enable them:
-
-    no warnings 'experimental::lexical_subs';
-    use feature 'lexical_subs';
-    my sub foo { ... }
-
 =item Explicit blessing to '' (assuming package main)
 
 (W misc) You are blessing a reference to a zero length string.  This has
@@ -5868,18 +5860,6 @@ will deny it.
 (F) The function indicated isn't implemented on this architecture,
 according to the probings of Configure.
 
-=item The lexical_subs feature is experimental
-
-(S experimental::lexical_subs) This warning is emitted if you
-declare a sub with C<my> or C<state>.  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::lexical_subs";
-    use feature "lexical_subs";
-    my sub foo { ... }
-
 =item The regex_sets feature is experimental
 
 (S experimental::regex_sets) This warning is emitted if you
diff --git a/pod/perlexperiment.pod b/pod/perlexperiment.pod
index a3052df..2e33177 100644
--- a/pod/perlexperiment.pod
+++ b/pod/perlexperiment.pod
@@ -46,18 +46,6 @@ See L<perlapi/PL_keyword_plugin> for the mechanism.
 
 Introduced in Perl 5.11.2
 
-=item Lexical subroutines
-
-Introduced in Perl 5.18
-
-See also: L<perlsub/Lexical Subroutines>
-
-Using this feature triggers warnings in the category
-C<experimental::lexical_subs>.
-
-The ticket for this feature is
-L<[perl #120085]|https://rt.perl.org/rt3/Ticket/Display.html?id=120085>.
-
 =item Regular Expression Set Operations
 
 Introduced in Perl 5.18
@@ -249,6 +237,12 @@ Introduced in Perl 5.20.0
 
 Accepted in Perl 5.24.0
 
+=item Lexical subroutines
+
+Introduced in Perl 5.18.0
+
+Accepted in Perl 5.26.0
+
 =back
 
 =head2 Removed features
diff --git a/pod/perlsub.pod b/pod/perlsub.pod
index 78de284..a9daa8f 100644
--- a/pod/perlsub.pod
+++ b/pod/perlsub.pod
@@ -1056,20 +1056,20 @@ using the CPAN module Sentinel or something similar.
 =head2 Lexical Subroutines
 X<my sub> X<state sub> X<our sub> X<subroutine, lexical>
 
-B<WARNING>: Lexical subroutines are still experimental.  The feature may be
-modified or removed in future versions of Perl.
-
-Lexical subroutines are only available under the C<use feature
-'lexical_subs'> pragma, which produces a warning unless the
-"experimental::lexical_subs" warnings category is disabled.
-
 Beginning with Perl 5.18, you can declare a private subroutine with C<my>
 or C<state>.  As with state variables, the C<state> keyword is only
 available under C<use feature 'state'> or C<use 5.010> or higher.
 
+Prior to Perl 5.26, lexical subroutines were deemed experimental and were
+available only under the C<use feature 'lexical_subs'> pragma.  They also
+produced a warning unless the "experimental::lexical_subs" warnings
+category was disabled.
+
 These subroutines are only visible within the block in which they are
 declared, and only after that declaration:
 
+    # Include these two lines if your code is intended to run under Perl
+    # versions earlier than 5.26.
     no warnings "experimental::lexical_subs";
     use feature 'lexical_subs';
 
@@ -1102,9 +1102,6 @@ containing block to the next.
 So, in general, "state" subroutines are faster.  But "my" subs are
 necessary if you want to create closures:
 
-    no warnings "experimental::lexical_subs";
-    use feature 'lexical_subs';
-
     sub whatever {
        my $x = shift;
        my sub inner {
@@ -1125,9 +1122,6 @@ subroutine of the same name.
 The two main uses for this are to switch back to using the package sub
 inside an inner scope:
 
-    no warnings "experimental::lexical_subs";
-    use feature 'lexical_subs';
-
     sub foo { ... }
 
     sub bar {
@@ -1143,9 +1137,6 @@ and to make a subroutine visible to other packages in the 
same scope:
 
     package MySneakyModule;
 
-    no warnings "experimental::lexical_subs";
-    use feature 'lexical_subs';
-
     our sub do_something { ... }
 
     sub do_something_with_caller {
diff --git a/regen/feature.pl b/regen/feature.pl
index 8892ceb..e8ecece 100755
--- a/regen/feature.pl
+++ b/regen/feature.pl
@@ -27,11 +27,9 @@ my %feature = (
     switch          => 'switch',
     bitwise         => 'bitwise',
     evalbytes       => 'evalbytes',
-    postderef       => 'postderef',
     array_base      => 'arybase',
     current_sub     => '__SUB__',
     refaliasing     => 'refaliasing',
-    lexical_subs    => 'lexsubs',
     postderef_qq    => 'postderef_qq',
     unicode_eval    => 'unieval',
     unicode_strings => 'unicode',
@@ -65,8 +63,7 @@ my %feature_bundle = (
                    evalbytes current_sub fc postderef_qq)],
 );
 
-# not actually used currently
-my @experimental = qw( lexical_subs );
+my @noops = qw( postderef lexical_subs );
 
 
 ###########################################################################
@@ -189,9 +186,9 @@ for (sort keys %Aliases) {
        qq'\$feature_bundle{"$_"} = \$feature_bundle{"$Aliases{$_}"};\n';
 };
 
-#print $pm "my \%experimental = (\n";
-#print $pm "    $_ => 1,\n", for @experimental;
-#print $pm ");\n";
+print $pm "my \%noops = (\n";
+print $pm "    $_ => 1,\n", for @noops;
+print $pm ");\n";
 
 print $pm <<EOPM;
 
@@ -369,7 +366,7 @@ read_only_bottom_close_and_rename($h);
 __END__
 package feature;
 
-our $VERSION = '1.43';
+our $VERSION = '1.44';
 
 FEATURES
 
@@ -563,17 +560,21 @@ This feature is available from Perl 5.16 onwards.
 
 =head2 The 'lexical_subs' feature
 
-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:
+In Perl versions prior to 5.26, this feature enabled
+declaration of subroutines via C<my sub foo>, C<state sub foo>
+and C<our sub foo> syntax.  See L<perlsub/Lexical Subroutines> for details.
 
-    no warnings "experimental::lexical_subs";
+This feature is available from Perl 5.18 onwards.  From Perl 5.18 to 5.24,
+it was classed as experimental, and Perl emitted a warning for its
+usage, except when explicitly disabled:
 
-This enables declaration of subroutines via C<my sub foo>, C<state sub foo>
-and C<our sub foo> syntax.  See L<perlsub/Lexical Subroutines> for details.
+  no warnings "experimental::lexical_subs";
 
-This feature is available from Perl 5.18 onwards.
+As of Perl 5.26, use of this feature no longer triggers a warning, though
+the C<experimental::lexical_subs> warning category still exists (for
+compatibility with code that disables it).  In addition, this syntax is
+not only no longer experimental, but it is enabled for all Perl code,
+regardless of what feature declarations are in scope.
 
 =head2 The 'postderef' and 'postderef_qq' features
 
@@ -781,6 +782,9 @@ sub __common {
             next;
         }
         if (!exists $feature{$name}) {
+            if (exists $noops{$name}) {
+                next;
+            }
             unknown_feature($name);
         }
        if ($import) {
diff --git a/t/lib/croak/toke b/t/lib/croak/toke
index 18dfa24..c295534 100644
--- a/t/lib/croak/toke
+++ b/t/lib/croak/toke
@@ -99,20 +99,17 @@ Missing $ on loop variable at - line 1.
 # NAME Missing name in "my sub"
 use feature 'lexical_subs'; my sub;
 EXPECT
-The lexical_subs feature is experimental at - line 1.
 Missing name in "my sub" at - line 1.
 ########
 # NAME Missing name in "our sub"
 use feature 'lexical_subs'; our sub;
 EXPECT
-The lexical_subs feature is experimental at - line 1.
 Missing name in "our sub" at - line 1.
 ########
 # NAME Missing name in "state sub"
-use 5.01; use feature 'lexical_subs';
+use 5.01;
 state sub;
 EXPECT
-The lexical_subs feature is experimental at - line 2.
 Missing name in "state sub" at - line 2.
 ########
 # NAME my sub pack::foo
@@ -120,8 +117,6 @@ use feature 'lexical_subs', 'state';
 my sub foo::bar;
 state sub foo::bear;
 EXPECT
-The lexical_subs feature is experimental at - line 2.
-The lexical_subs feature is experimental at - line 3.
 "my" subroutine &foo::bar can't be in a package at - line 2, near "my sub 
foo::bar"
 "state" subroutine &foo::bear can't be in a package at - line 3, near "state 
sub foo::bear"
 Execution of - aborted due to compilation errors.
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index d36d419..cf7a798 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -997,15 +997,11 @@ sub phred { 2 };
 state sub jorge { 1 }
 sub jorge () { 2 } # should *not* produce redef warnings by default
 EXPECT
-The lexical_subs feature is experimental at - line 3.
 Prototype mismatch: sub fred () vs none at - line 4.
 Constant subroutine fred redefined at - line 4.
-The lexical_subs feature is experimental at - line 5.
 Prototype mismatch: sub george: none vs () at - line 6.
-The lexical_subs feature is experimental at - line 7.
 Prototype mismatch: sub phred () vs none at - line 8.
 Constant subroutine phred redefined at - line 8.
-The lexical_subs feature is experimental at - line 9.
 Prototype mismatch: sub jorge: none vs () at - line 10.
 ########
 # op.c
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index 493c8a2..0b23fe5 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -1228,7 +1228,7 @@ Use of :locked is deprecated at - line 4.
 Use of :locked is deprecated at - line 6.
 ########
 # toke.c
-use warnings "syntax"; use feature 'lexical_subs';
+use warnings "syntax";
 sub proto_after_array(@$);
 sub proto_after_arref(\@$);
 sub proto_after_arref2(\[@$]);
@@ -1257,11 +1257,8 @@ Prototype after '@' for main::proto_after_array : @$ at 
- line 3.
 Prototype after '%' for main::proto_after_hash : %$ at - line 7.
 Illegal character after '_' in prototype for main::underscore_fail : $_$ at - 
line 12.
 Prototype after '@' for main::underscore_after_at : @_ at - line 13.
-The lexical_subs feature is experimental at - line 14.
 Prototype after '@' for hour : @$ at - line 14.
-The lexical_subs feature is experimental at - line 15.
 Prototype after '@' for migh : @$ at - line 15.
-The lexical_subs feature is experimental at - line 17.
 Prototype after '@' for estate : @$ at - line 17.
 Prototype after '@' for hour : @$ at - line 19.
 Prototype after '@' for migh : @$ at - line 20.
diff --git a/t/op/lexsub.t b/t/op/lexsub.t
index 19a99fe..3fa17ac 100644
--- a/t/op/lexsub.t
+++ b/t/op/lexsub.t
@@ -7,24 +7,10 @@ BEGIN {
     *bar::is = *is;
     *bar::like = *like;
 }
-plan 152;
-
-# -------------------- Errors with feature disabled -------------------- #
-
-eval "#line 8 foo\nmy sub foo";
-is $@, qq 'Experimental "my" subs not enabled at foo line 8.\n',
-  'my sub unexperimental error';
-eval "#line 8 foo\nCORE::state sub foo";
-is $@, qq 'Experimental "state" subs not enabled at foo line 8.\n',
-  'state sub unexperimental error';
-eval "#line 8 foo\nour sub foo";
-is $@, qq 'Experimental "our" subs not enabled at foo line 8.\n',
-  'our sub unexperimental error';
+plan 149;
 
 # -------------------- our -------------------- #
 
-no warnings "experimental::lexical_subs";
-use feature 'lexical_subs';
 {
   our sub foo { 42 }
   is foo, 42, 'calling our sub from same package';
diff --git a/toke.c b/toke.c
index 5335400..39c59c8 100644
--- a/toke.c
+++ b/toke.c
@@ -7781,17 +7781,7 @@ Perl_yylex(pTHX)
            if (isIDFIRST_lazy_if(s,UTF)) {
                s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len);
                if (len == 3 && strnEQ(PL_tokenbuf, "sub", 3))
-               {
-                   if (!FEATURE_LEXSUBS_IS_ENABLED)
-                       Perl_croak(aTHX_
-                                 "Experimental \"%s\" subs not enabled",
-                                  tmp == KEY_my    ? "my"    :
-                                  tmp == KEY_state ? "state" : "our");
-                   Perl_ck_warner_d(aTHX_
-                       packWARN(WARN_EXPERIMENTAL__LEXICAL_SUBS),
-                       "The lexical_subs feature is experimental");
                    goto really_sub;
-               }
                PL_in_my_stash = find_in_my_stash(PL_tokenbuf, len);
                if (!PL_in_my_stash) {
                    char tmpbuf[1024];

--
Perl5 Master Repository

Reply via email to