develooper Front page | perl.perl5.porters | Postings from June 2016

[perl #128479] Assigning hashref to symtable not an error since(somewhere before 5.21.10 )

Thread Previous | Thread Next
Father Chrysostomos via RT
June 25, 2016 14:32
[perl #128479] Assigning hashref to symtable not an error since(somewhere before 5.21.10 )
Message ID:
On Sat Jun 25 07:13:49 2016, sprout wrote:
> The changes in how subroutines are stored in stashes are probably
> responsible.

No, they are not.  It was:

211a4342c9ab2a1353f618cb96de02610eaa1989 is the first bad commit
commit 211a4342c9ab2a1353f618cb96de02610eaa1989
Author: Father Chrysostomos <>
Date:   Fri Aug 29 20:18:23 2014 -0700

    Avoid vivifying stuff when looking up barewords
    Till now, when a bareword was looked up to see whether it was a sub-
    routine, an rv2cv op was created (to allow PL_check hooks to override
    the process), which was then asked for its GV.
    Afterwards, the GV was downgraded back to nothing if possible.
    So a lot of the time a GV was autovivified and then discarded.  This
    has been the case since f74617600 (5.12).
    If we know there is a good chance that the rv2cv op is about to be
    deleted, we can avoid that by passing a flag to the new op.
    Also f74617600 actually changed the behaviour by vivifying stashes
    that used not be vivified:
    sub foo { print shift, "\n" }
    SUPER::foo bar if 0;
    foo SUPER;
    Output in 5.10:
    Output as of this commit:
    Output in 5.12 to 5.21.3:
        Can't locate object method "foo" via package "SUPER" at - line 3.

That was an optimisation and regression fix.  In fact, it restored the 5.10 behaviour:

$ perl5.12 -e 'BEGIN {$Foo::{bar} = {}} Foo::bar()'
Cannot convert a reference to HASH to typeglob at -e line 1.
$ perl5.10 -e 'BEGIN {$Foo::{bar} = {}} warn defined Foo::bar()'
Warning: something's wrong at -e line 1.
$ perl5.8.7 -e 'BEGIN {$Foo::{bar} = {}} Foo::bar()'
Undefined subroutine &Foo::bar called at -e line 1.

So this was not terribly consistent to begin with. :-)


Father Chrysostomos

via perlbug:  queue: perl5 status: open

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About