This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Disable $[ under 5.16
authorFather Chrysostomos <sprout@cpan.org>
Fri, 16 Dec 2011 00:26:16 +0000 (16:26 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 16 Dec 2011 00:26:16 +0000 (16:26 -0800)
commit7d69d4a61be1619f90910462eac42234c874712e
tree6c7be0f836c3bb4cd3b20c091c4362a22e8c02fd
parentb22bbcf0786b5b4b9edfde241ba29141bb99f219
Disable $[ under 5.16

This adds the array_base feature to feature.pm

Perl_feature_is_enabled has been modified to use PL_curcop, rather
than PL_hintgv, so it can work with run-time hints as well.
(PL_curcop holds the current state op at run time, and &PL_compiling
at compile time, so it works for both.)  The hints in $^H are not
stored in the same place at compile time and run time, so the FEATURE_IS_ENABLED macro has been modified to check first whether
PL_curop == &PL_compiling.

Since array_base is on by default with no hint for it in %^H, it is
a ‘negative’ feature, whose entry in %^H turns it off.  feature.pm
has been modified to support such negative features.  The new FEATURE_IS_ENABLED_d can check whether such default features
are enabled.

This does make things less efficient, as every version declaration
now loads feature.pm to disable all features (including turning off
array_base, which entails adding an entry to %^H) before loading the
new bundle.  I have plans to make this more efficient.
13 files changed:
embed.fnc
ext/arybase/arybase.xs
gv.c
lib/feature.pm
mg.c
op.c
perl.h
proto.h
t/lib/feature/bundle
t/lib/feature/implicit
t/op/array_base.t
t/op/override.t
toke.c