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

multi sub not importing when precompiled #3346

Open
p6rt opened this issue Feb 25, 2014 · 7 comments
Open

multi sub not importing when precompiled #3346

p6rt opened this issue Feb 25, 2014 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 25, 2014

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

Searchable as RT121319$

@p6rt
Copy link
Author

p6rt commented Feb 25, 2014

From @raydiak

See attached. I've only tested this on JVM. When run with -Iblib, dispatch fails. When run with -Ilib, it appears to work correctly, but the stack trace shows A being called from B...don't know if thats expected behavior, but it surprised me enough to mention it.

@p6rt
Copy link
Author

p6rt commented Feb 25, 2014

@p6rt
Copy link
Author

p6rt commented Mar 1, 2014

From @FROGGS

Can you put that code in a repo or gist? I can't open the tarball...

@p6rt
Copy link
Author

p6rt commented Mar 1, 2014

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

@p6rt
Copy link
Author

p6rt commented Mar 2, 2014

@p6rt
Copy link
Author

p6rt commented Mar 2, 2014

From @FROGGS

perl6-m seems to reveal it a bit​:

I can explain this​:
$ perl6-m -Ilib test.p6
everything seems to be working correctly
  in sub foo at /home/froggs/dev/RT#​121319/lib/A.pm6​:6
  in sub foo at /home/froggs/dev/RT#​121319/lib/B.pm6​:3
  in block at test.p6​:5
You use A which uses B, which declares the multi foo. At that time the proto is generated, and later in A the multi foo is added to that proto. So the dispatch happens in the proto of B.pm.

Now we know that different compilation units are in charge to give the full list of candidates, but something happens so that the candidate of A is not added to the proto of B​:
$ perl6-m -Iblib test.p6
Cannot call 'foo'; none of these signatures match​:
:(B $foo)
  in sub foo at lib/B.pm6​:3
  in block at test.p6​:5

@p6rt
Copy link
Author

p6rt commented Mar 2, 2014

From @FROGGS

The candidate in A is added to the proto as long as we compile A.pm, but after deserializing A we only have the proto of B.

You can prove that by added "BEGIN say &foo.candidates;" before and after the multi declaration as well as in the test.p6 after the use statement.

@p6rt p6rt added the precomp label Jan 5, 2020
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

1 participant