X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/d6402ebec2dec2c019e80f02e886e8c905b06d51..23d16d50b9b81f01c23562fbd69afe64a4d4af23:/regen/feature.pl diff --git a/regen/feature.pl b/regen/feature.pl index 1c91fa2..e1f30df 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -28,6 +28,7 @@ my %feature = ( evalbytes => 'evalbytes', array_base => 'arybase', current_sub => '__SUB__', + lexical_subs => 'lexsubs', unicode_eval => 'unieval', unicode_strings => 'unicode', fc => 'fc', @@ -37,27 +38,31 @@ my %feature = ( # versions, any code below that uses %BundleRanges will have to # be changed to account. +# 5.odd implies the next 5.even, but an explicit 5.even can override it. my %feature_bundle = ( all => [ keys %feature ], default => [qw(array_base)], "5.9.5" => [qw(say state switch array_base)], "5.10" => [qw(say state switch array_base)], "5.11" => [qw(say state switch unicode_strings array_base)], - "5.12" => [qw(say state switch unicode_strings array_base)], "5.13" => [qw(say state switch unicode_strings array_base)], - "5.14" => [qw(say state switch unicode_strings array_base)], "5.15" => [qw(say state switch unicode_strings unicode_eval evalbytes current_sub fc)], - "5.16" => [qw(say state switch unicode_strings unicode_eval - evalbytes current_sub fc)], "5.17" => [qw(say state switch unicode_strings unicode_eval evalbytes current_sub fc)], ); +my @experimental = qw( lexical_subs ); + ########################################################################### # More data generated from the above +for (keys %feature_bundle) { + next unless /^5\.(\d*[13579])\z/; + $feature_bundle{"5.".($1+1)} ||= $feature_bundle{$_}; +} + my %UniqueBundles; # "say state switch" => 5.10 my %Aliases; # 5.12 => 5.11 for( sort keys %feature_bundle ) { @@ -149,7 +154,7 @@ sub longest { print $pm "our %feature = (\n"; my $width = length longest keys %feature; -for(sort { length $a <=> length $b } keys %feature) { +for(sort { length $a <=> length $b || $a cmp $b } keys %feature) { print $pm " $_" . " "x($width-length) . " => 'feature_$feature{$_}',\n"; } @@ -170,6 +175,10 @@ 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 < length $b } keys %feature + sort { length $a <=> length $b || $a cmp $b } keys %feature ) { my($first,$last) = map { (my $__ = uc) =~ y/.//d; $__ } @{$BundleRanges{$_}}; @@ -278,7 +287,7 @@ EOI EOH3 } - else { + elsif ($first) { print $h <, for example), features have a lexical -effect. C will only make the feature "foo" available +effect. C will only make the feature "foo" available from that point to the end of the enclosing block. { @@ -435,7 +454,8 @@ C tells the compiler to use Unicode semantics in all string operations executed within its scope (unless they are also within the scope of either C or C). The same applies to all regular expressions compiled within the scope, even if executed outside -it. +it. It does not change the internal representation of strings, but only how +they are interpreted. C tells the compiler to use the traditional Perl semantics wherein the native character set semantics is used unless it is @@ -521,6 +541,20 @@ See L for details. This feature is available from Perl 5.16 onwards. +=head2 The 'lexical_subs' feature + +B: This feature is still experimental and the implementation may +change in future versions of Perl. For this reason, F will +warn when you enable the feature, unless you have explicitly disabled the +warning: + + no warnings "experimental::lexical_subs"; + +This enables declaration of subroutines via C, C +and C syntax. See L for details. + +This feature is available from Perl 5.18 onwards. + =head1 FEATURE BUNDLES It's possible to load multiple features together, using @@ -644,6 +678,11 @@ sub __common { if ($import) { $^H{$feature{$name}} = 1; $^H |= $hint_uni8bit if $name eq 'unicode_strings'; + if ($experimental{$name}) { + require warnings; + warnings::warnif("experimental::$name", + "The $name feature is experimental"); + } } else { delete $^H{$feature{$name}}; $^H &= ~ $hint_uni8bit if $name eq 'unicode_strings';