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

reference to outside function prevents role instantiation #5271

Open
p6rt opened this issue Apr 27, 2016 · 3 comments
Open

reference to outside function prevents role instantiation #5271

p6rt opened this issue Apr 27, 2016 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 27, 2016

Migrated from rt.perl.org#128010 (status was 'new')

Searchable as RT128010$

@p6rt
Copy link
Author

p6rt commented Apr 27, 2016

From @grondilu

In file A.pm6 : unit class A ; our sub f {}
In file B.pm6 : unit role B ; use A ; &A :​:f ;

$ perl6 -I. -e ‘use B ; class :​: does B {} ;’
===SORRY!=== Error while compiling -e
Could not instantiate role 'B'​:
Cannot find method 'package_at_key'​: no method cache and no .^find_method
at -e​:1

Notice that &A :​:f is not even called, only its reference is used in void context.

Also notice that without explicit compilation units it works fine :

$ perl6 -e ‘class A { our sub f {} } ; role B { &A​::f } ; class :​: does B {} ;’

@p6rt
Copy link
Author

p6rt commented Jul 9, 2016

From @zoffixznet

Still present on This is Rakudo version 2016.06-154-g55c359e built on MoarVM version 2016.06-9-g8fc21d5
implementing Perl 6.c.

@p6rt p6rt added the Bug label Jan 5, 2020
@usev6
Copy link

usev6 commented Oct 6, 2023

If I'm not mistaken, this works now:

$ mkdir gh5271
$ echo 'unit class A; our sub f {}' >gh5271/A.rakumod
$ echo 'unit role B; use A; &A::f' >gh5271/B.rakumod
$ ./rakudo-m -Igh5271 -e 'use B; class :: does B {}; say "alive"'
alive

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

No branches or pull requests

2 participants