Rakudo: $*PERL.version is wrong

Created on 27 Oct 2018  ·  3Comments  ·  Source: rakudo/rakudo

It keeps reporting 6.c even if other version is used:

<Zoffix__> c: 671c3d601,671c3d601~1 use v6.d.PREVIEW; use nqp; say nqp::getcomp('perl6').language_version; $*PERL.version.say
<committable6> Zoffix__, ¦671c3d6: «6.d␤v6.c␤» ¦671c3d601~1: «6.d␤v6.d␤»

According to bisectable, the change occurred during https://github.com/rakudo/rakudo/commit/671c3d60161053809415a2eb85097b0714417b56

(cc @nine, if you have any ideas)

Most helpful comment

I'd say not all hope is lost. The point of that commit was to avoid version parsing on startup or on first load of a module because it's costly. The invalid assumption was, that we know the Perl version anyway at compile time. But it's wrong by only one character: we know the Perl versions at compile time.

We could still prepare Version objects for all supported Perl versions (i.e. 6.c and 6.d) at BEGIN time and have the version method chose the right one at runtime.

All 3 comments

I'd say not all hope is lost. The point of that commit was to avoid version parsing on startup or on first load of a module because it's costly. The invalid assumption was, that we know the Perl version anyway at compile time. But it's wrong by only one character: we know the Perl versions at compile time.

We could still prepare Version objects for all supported Perl versions (i.e. 6.c and 6.d) at BEGIN time and have the version method chose the right one at runtime.

I de-BEGIN-ified $*PERL in https://github.com/rakudo/rakudo/commit/c9ecfb7ae5 to get rid of this bug, but I didn't do anything else that was suggested in the above comment.


The SAP tests for language switching technically cover this bug, as they use $*PERL.version: https://github.com/perl6/roast/commit/2daefc06fd

Closing via #3040

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raiph picture raiph  ·  3Comments

Altai-man picture Altai-man  ·  3Comments

AlexDaniel picture AlexDaniel  ·  5Comments

codesections picture codesections  ·  3Comments

jonathanstowe picture jonathanstowe  ·  3Comments