package feature;
-our $VERSION = '1.36';
+our $VERSION = '1.42';
our %feature = (
fc => 'feature_fc',
say => 'feature_say',
state => 'feature_state',
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',
"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)],
- "all" => [qw(array_base current_sub evalbytes fc lexical_subs postderef postderef_qq say signatures 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)],
"default" => [qw(array_base)],
);
$feature_bundle{"5.18"} = $feature_bundle{"5.15"};
$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.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.
=head2 The 'switch' feature
+B<WARNING>: Because the L<smartmatch operator|perlop/"Smartmatch Operator"> is
+experimental, Perl will warn when you use this feature, unless you have
+explicitly disabled the warning:
+
+ no warnings "experimental::smartmatch";
+
C<use feature 'switch'> tells the compiler to enable the Perl 6
given/when construct.
This feature is available from Perl 5.18 onwards.
+=head2 The 'postderef' and 'postderef_qq' features
+
+The 'postderef_qq' feature extends the applicability of L<postfix
+dereference syntax|perlref/Postfix Dereference Syntax> so that postfix array
+and scalar dereference are available in double-quotish interpolations. For
+example, it makes the following two statements equivalent:
+
+ my $s = "[@{ $h->{a} }]";
+ my $s = "[$h->{a}->@*]";
+
+This feature is available from Perl 5.20 onwards. In Perl 5.20 and 5.22, it
+was classed as experimental, and Perl emitted a warning for its
+usage, except when explicitly disabled:
+
+ no warnings "experimental::postderef";
+
+As of Perl 5.24, use of this feature no longer triggers a warning, though
+the C<experimental::postderef> warning category still exists (for
+compatibility with code that disables it).
+
+The 'postderef' feature was used in Perl 5.20 and Perl 5.22 to enable
+postfix dereference syntax outside double-quotish interpolations. In those
+versions, using it triggered the C<experimental::postderef> warning in the
+same way as the 'postderef_qq' feature did. As of Perl 5.24, 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 'signatures' feature
B<WARNING>: This feature is still experimental and the implementation may
This feature is available from Perl 5.20 onwards.
+=head2 The 'refaliasing' 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:
+
+ no warnings "experimental::refaliasing";
+
+This enables aliasing via assignment to references:
+
+ \$a = \$b; # $a and $b now point to the same scalar
+ \@a = \@b; # to the same array
+ \%a = \%b;
+ \&a = \&b;
+ foreach \%hash (@array_of_hash_refs) {
+ ...
+ }
+
+See L<perlref/Assigning to References> for details.
+
+This feature is available from Perl 5.22 onwards.
+
+=head2 The 'bitwise' 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:
+
+ no warnings "experimental::bitwise";
+
+This makes the four standard bitwise operators (C<& | ^ ~>) treat their
+operands consistently as numbers, and introduces four new dotted operators
+(C<&. |. ^. ~.>) that treat their operands consistently as strings. The
+same applies to the assignment variants (C<&= |= ^= &.= |.= ^.=>).
+
+See L<perlop/Bitwise String Operators> for details.
+
+This feature is available from Perl 5.22 onwards.
+
=head1 FEATURE BUNDLES
It's possible to load multiple features together, using
:5.20 say state switch unicode_strings
unicode_eval evalbytes current_sub fc
+ :5.22 say state switch unicode_strings
+ unicode_eval evalbytes current_sub fc
+
+ :5.24 say state switch unicode_strings
+ unicode_eval evalbytes current_sub fc
+ postderef_qq
+
The C<:default> bundle represents the feature set that is enabled before
any C<use feature> or C<no feature> declaration.
=cut
sub import {
- my $class = shift;
+ shift;
if (!@_) {
croak("No features specified");
}
sub unimport {
- my $class = shift;
+ shift;
# A bare C<no feature> should reset to the default bundle
if (!@_) {