Skip Menu |

Date: Fri, 17 Jul 2015 15:00:32 +0200
To: rakudobug [...] perl.org
Subject: [BUG] Using a compiled (mbc) wrapping trait: Cannot invoke this object (REPR: Null, cs = 0)
From: cdc <perl6 [...] 6dof.xyz>
Download (untitled) / with headers
text/plain 631b
How to reproduce: cdc:~/golf$ cat lib/Golf.pm6 unit module Golf; multi sub trait_mod:<is>(Routine $routine, :$wrapped!) { $routine.wrap: -> |args { callwith(|args) } } sub foo is export is wrapped { say 'OK' } cdc:~/golf$ panda-build Compiling lib/Golf.pm6 to mbc cdc:~/golf$ PERL6LIB=$PWD/blib/lib perl6 -e 'use Golf; foo' Cannot invoke this object (REPR: Null, cs = 0) in block at lib/Golf.pm6:4 in any enter at src/gen/m-Metamodel.nqp:3560 Expected result -- same as without precompilation: cdc:~/golf$ PERL6LIB=$PWD/lib perl6 -e 'use Golf; foo' OK
CC: perl6 [...] 6dof.xyz
Subject: [perl #125634] [BUG] Using a compiled (mbc) wrapping trait: Cannot invoke this object (REPR: Null, cs = 0)
To: perl6 via RT <perl6-bugs-followup [...] perl.org>
From: cdc <perl6 [...] 6dof.xyz>
Date: Fri, 17 Jul 2015 16:09:47 +0200
Download (untitled) / with headers
text/plain 328b
For information, it segfaults -- if pre-compiled -- when modifying the code snippet this way: +sub call-with(|args) { callwith(|args) } + multi sub trait_mod:<is>(Routine $routine, :$wrapped!) { - $routine.wrap: -> |args { callwith(|args) } + $routine.wrap: -> |args { call-with(|args) } }
Download (untitled) / with headers
text/plain 153b
It golfs to this in the module: constant &xxx = -> |args { nqp::say('in closure'); nqp::say(nqp::getlex('&say').^name); }; sub foo is export { xxx() }
Subject: Precomp issue with trait_mod + add_method
Download (untitled) / with headers
text/plain 393b
See the attached files. If you run test.pl without a precompiled Example.pm, everything works fine (FALLBACK is added to the Example class and the die() is called). However, if you precompile Example.pm, you get the following error message: Cannot invoke this object (REPR: Null, cs = 0) in block at Example.pm:6 in any at src/gen/m-Metamodel.nqp:2867 in block <unit> at test2.pl:6
Subject: Example.pm
Download Example.pm
text/x-perl 257b
use v6; my multi sub trait_mod:<is>(Mu:U $class, Bool :$NYI, *%rest) { my $class-name = $class.^name; $class.^add_method('FALLBACK', -> | { die "Unable to call method on NYI class $class-name"; }); } our class Foo is NYI is export { }
Subject: test.pl
Download test.pl
text/x-perl 54b
use v6; use Example; my $f = Foo.new; say $f.greet;
To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
From: Lloyd Fournier <lloyd.fourn [...] gmail.com>
Date: Wed, 20 Jan 2016 04:09:52 +0000
Subject: [perl #125634]
Download (untitled) / with headers
text/plain 517b
I've just run into this while trying to get old code working with precomp.

These are all really the same thing I think:


I actually made an attempt at helping. A few instances of the bug can be fixed by putting jnthn++'s "begin_time_lexical_fixup" in a few more places, but I coulnd't figure out how to get closures declared in 'is' traits to work.

LL
Download (untitled) / with headers
text/plain 710b
I think that this might be related to another bug I found: https://rt.perl.org/Ticket/Display.html?id=127089 On 2016-01-19 20:10:14, lloyd.fourn@gmail.com wrote: Show quoted text
> I've just run into this while trying to get old code working with precomp. > > These are all really the same thing I think: > > https://rt.perl.org/Public/Bug/Display.html?id=126818 > https://rt.perl.org/Public/Bug/Display.html?id=127034 > https://rt.perl.org/Public/Bug/Display.html?id=127112 > > I actually made an attempt at helping. A few instances of the bug can be > fixed by putting jnthn++'s "begin_time_lexical_fixup" in a few more places, > but I coulnd't figure out how to get closures declared in 'is' traits to > work. > > LL


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org