Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with CALLER invocations in a precompiled module with subs exported by a zef/panda installed module #5402

Open
p6rt opened this issue Jun 25, 2016 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Jun 25, 2016

Migrated from rt.perl.org#128483 (status was 'open')

Searchable as RT128483$

@p6rt
Copy link
Author

p6rt commented Jun 25, 2016

From @zoffixznet

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

@p6rt
Copy link
Author

p6rt commented Jun 26, 2016

From @LLFourn

I think this is another *compile-time closure loses it's outer ctx at
runtime* bug. I was trying to keep track of them​:
https://rt.perl.org/Public/Bug/Display.html?id=125634

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

https://github.com/zoffixznet/perl6-Pretty-Topic/blob/master/lib/Pretty/Topic.pm6#L8

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​:

# 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-archive.perl.org/perl6/Ticket/Display.html?id=128483 >

The Pretty​::Topic module exports this sub​:

  sub term&#8203;:\<♥> \{ $CALLER&#8203;::\_ \}

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

@p6rt
Copy link
Author

p6rt commented Jun 26, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 9, 2016

From @zoffixznet

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant