develooper Front page | perl.perl5.changes | Postings from March 2021

[Perl/perl5] d5f88b: Default the COP's cop_features to the bitmaskof t...

From:
Nicholas Clark via perl5-changes
Date:
March 24, 2021 15:53
Subject:
[Perl/perl5] d5f88b: Default the COP's cop_features to the bitmaskof t...
Message ID:
Perl/perl5/push/refs/heads/two-personalities/000000-562075@github.com
  Branch: refs/heads/two-personalities
  Home:   https://github.com/Perl/perl5
  Commit: d5f88b34531704a752a34ccf475e0ad62775f6c4
      https://github.com/Perl/perl5/commit/d5f88b34531704a752a34ccf475e0ad62775f6c4
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2021-03-24 (Wed, 24 Mar 2021)

  Changed paths:
    M feature.h
    M mg.c
    M op.c
    M perl.c
    M pp_ctl.c
    M regen/feature.pl

  Log Message:
  -----------
  Default the COP's cop_features to the bitmask of the default-on features.

The assumption is that cop_features holds the bitmask of the currently
enabled feature set, and hence that S_magic_sethint_feature() can
incrementally update it as keys for features are set in/cleared from %^H.

However, this overlooks one problem - the default set of features enabled
(keys) is not empty, the default for %^H *is* empty, but as long as %^H
is empty the internals knows that it is *not* running with a custom feature
set, so avoids the complexity of setting up %^H.

There's a C test for features that knows about this, but it was only
correctly handling (Perl) compile-time tests for features. That hasn't
been noticed before, because all the "default on" features are compile-time
only.

This commit fixes things so that run-time default-on features also work
properly, by setting each COP's cop_features to the value of the bits
set at the COP's compile time - ie the same approach as cop_hints.


  Commit: 6a7c59a5ca70104c209915a5a7d4ecb6ba3c881b
      https://github.com/Perl/perl5/commit/6a7c59a5ca70104c209915a5a7d4ecb6ba3c881b
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2021-03-24 (Wed, 24 Mar 2021)

  Changed paths:
    M embedvar.h
    M feature.h
    M gv.c
    M intrpvar.h
    M lib/feature.pm
    M mg.c
    M perl.c
    M regen/feature.pl
    M t/lib/universal.t

  Log Message:
  -----------
  FIXME - A feature "five", defaulting to enabled, which leaves $] as 5.x.y

If you disable the feature, $] and $^V report 7.0.0

FIXME 1 - no docs
FIXME 2 - no tests (but no test failures either)


  Commit: 39b5ce8a13a1e8b92fd5dd23a3f3fc9433bde5f0
      https://github.com/Perl/perl5/commit/39b5ce8a13a1e8b92fd5dd23a3f3fc9433bde5f0
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2021-03-24 (Wed, 24 Mar 2021)

  Changed paths:
    M feature.h
    M lib/feature.pm
    M pp_ctl.c
    M regen/feature.pl

  Log Message:
  -----------
  Special case `use 7` to be an acceptable version, and disable feature "five".

`no 7;` doesn't renable feature "five" (but `use feature "five";`).
This probably isn't worth "fixing".


  Commit: 1e610a74bbfcd59fb5974d3512b803899fbe39db
      https://github.com/Perl/perl5/commit/1e610a74bbfcd59fb5974d3512b803899fbe39db
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2021-03-24 (Wed, 24 Mar 2021)

  Changed paths:
    M embedvar.h
    M feature.h
    M intrpvar.h
    M perl.c
    M regen/feature.pl

  Log Message:
  -----------
  Set the feature bundle to '7' if the executable is named perl7.


  Commit: e851780996f5e47dd0ea3043c19b2a932a6fc0d9
      https://github.com/Perl/perl5/commit/e851780996f5e47dd0ea3043c19b2a932a6fc0d9
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2021-03-24 (Wed, 24 Mar 2021)

  Changed paths:
    M installperl

  Log Message:
  -----------
  XXX - unconditionally install a perl5 and perl7 binary.


  Commit: 56207513256399109bb02fd8528604ba40fc7acd
      https://github.com/Perl/perl5/commit/56207513256399109bb02fd8528604ba40fc7acd
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2021-03-24 (Wed, 24 Mar 2021)

  Changed paths:
    M feature.h
    M lib/feature.pm
    M regen/feature.pl

  Log Message:
  -----------
  XXX hacky "strict" feature enabled for 7 only.

As a proof-of-concept this works (and was easier than trying to fake warnings
for strict violations) - if your executable is perl7, strict defaults to on.
If the same binary is perl5, it is off.

Fails 7 tests. I think that at least one failure is a real bug

But several seem to be "golden results need updating"
or "some tests don't assume that feature bits exist that are in the future"

Probably not the best way to do it - do we really *need* a feature bit for it?


Compare: https://github.com/Perl/perl5/compare/d5f88b345317%5E...562075132563



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About