Skip Menu |
Report information
Id: 128483
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG][PRECOMPILATION] Issues with CALLER invocations in a precompiled module with subs exported by a zef/panda installed module
The Pretty::Topic module exports this sub: sub term:<♥> { $CALLER::_ } If a user-made module uses Pretty::Topic and invokes that sub, `Cannot invoke this object` error occurs. The error goes away if the user-made module has `no precompilation` pragma. The issue does not occur if the sub term:<♥> { $CALLER::_ } is defined in a user-made module (and not something installed with panda/zef) or if the Pretty::Topic is included in a script and not a precompiled module: $ tree . └── A.pm6 0 directories, 1 file $ cat A.pm6 unit class A; use Pretty::Topic '♥'; method update { say ♥ for ^4; } $ perl6 -I. -MA -e 'A.new.update' Cannot invoke this object in sub at sources/EDE2FE63DE5B1C96179DD91E427A5419C919578A (Pretty::Topic) line 8 in method update at /tmp/tmp.97W1AJFY3o/A.pm6 (A) line 3 in block <unit> at -e line 1 $ pico A.pm6 $ cat A.pm6 no precompilation; unit class A; use Pretty::Topic '♥'; method update { say ♥ for ^4; } $ perl6 -I. -MA -e 'A.new.update' 0 1 2 3 $ $ perl6 -e 'use Pretty::Topic "♥"; say ♥ for ^4;' 0 1 2 3
To: perl6-compiler [...] perl.org, bugs-bitbucket [...] rt.perl.org
Subject: Re: [perl #128483] [BUG][PRECOMPILATION] Issues with CALLER invocations in a precompiled module with subs exported by a zef/panda installed module
From: Lloyd Fournier <lloyd.fourn [...] gmail.com>
Date: Sun, 26 Jun 2016 03:57:50 +0000
Download (untitled) / with headers
text/plain 1.8k
I think this is another compile-time closure loses it's outer ctx at runtime bug. I was trying to keep track of them:

Your lovely module has a compile time closure here (EXPORT Is called at compile time):


If you actually did do:

 sub term:<♥> is export { $CALLER::_ }

it would probably work.

On Sat, Jun 25, 2016 at 11:19 PM Zoffix Znet <perl6-bugs-followup@perl.org> wrote:
Show quoted text
# New Ticket Created by  Zoffix Znet
# Please include the string:  [perl #128483]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=128483 >


The Pretty::Topic module exports this sub:

      sub term:<♥> { $CALLER::_ }

If a user-made module uses Pretty::Topic and invokes that sub, `Cannot invoke this object` error occurs. The error goes away if the user-made module has `no precompilation` pragma. The issue does not occur if the sub term:<♥> { $CALLER::_ } is defined in a user-made module (and not something installed with panda/zef) or if the Pretty::Topic is included in a script and not a precompiled module:


$ tree
.
└── A.pm6

0 directories, 1 file

$ cat A.pm6
unit class A;
use Pretty::Topic '♥';
method update { say ♥ for ^4; }

$ perl6 -I. -MA -e 'A.new.update'
Cannot invoke this object
  in sub  at sources/EDE2FE63DE5B1C96179DD91E427A5419C919578A (Pretty::Topic) line 8
  in method update at /tmp/tmp.97W1AJFY3o/A.pm6 (A) line 3
  in block <unit> at -e line 1

$ pico A.pm6

$ cat A.pm6
no precompilation;
unit class A;
use Pretty::Topic '♥';
method update { say ♥ for ^4; }

$ perl6 -I. -MA -e 'A.new.update'
0
1
2
3
$

$ perl6 -e 'use Pretty::Topic "♥"; say ♥ for ^4;'
0
1
2
3
Download (untitled) / with headers
text/plain 514b
The error message changed slightly (mentions '(REPR: Null; VMNull)' now): $ perl6 -v This is Rakudo version 2016.06-154-g55c359e built on MoarVM version 2016.06-9-g8fc21d5 implementing Perl 6.c. $ perl6 -I. -MA -e 'A.new.update' Cannot invoke this object (REPR: Null; VMNull) in sub at /home/zoffix/.rakudobrew/moar-nom/install/share/perl6/site/sources/EDE2FE63DE5B1C96179DD91E427A5419C919578A (Pretty::Topic) line 8 in method update at /tmp/tmp.tJh8djfbln/A.pm6 (A) line 1 in block <unit> at -e line 1


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