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
- runtime looping. #6407
Comments
From andynparker@googlemail.comGreetings! I have written a module to process some numeric data types and found Here is minimal code for the module: use v6.c; class Fpa does Numeric { multi infix:<+> ( Fpa:D $left, Fpa:D $right --> Fpa ) is equiv( our sub fpaAdd ( Fpa:D $left, Fpa:D $right --> Fpa ) { } # end of package. Here is some test driver code to call the module (test2.pm6): use v6c; my Fpa $x = Fpa.new(); Here is a run of the test2.pm6 code that calls the module: perl6-m test2.pm6 Strangely, if the multi are taken out of the module and put in the test If the "does Numeric" is removed from the class definition, it does not Cannot resolve caller Numeric(test1::EXPORT::DEFAULT::Fpa: ); none of Is this expected behaviour? Regards, Andrew N Parker |
From @skidsAnalysis... you've run into a nest of LTA/bugs. 1) First off, this will loop: perl6 -e 'class A does Numeric { }; say A.new + A.new' The reason it loops is because the default infix:<+> (provided by Numeric) does this: multi sub infix:<+>(\a, \b) { a.Numeric + b.Numeric } ...and the default .Numeric, also provided by Numeric, is just { self } This is where the loop comes from. The problem would be avoided if the proper infix:<+> candidate were being 2) A simple explanation would have been that the EXPORT::DEFAULT needs to contain an &infix:<+> my constant &infix:<+> = &infix:<+>; ...then the multis will show up in &infix:<+>.candidates>>.signature.say Whether the presence of those multis should add the Stash key automatically 3) But it was not that simple... I know the docs say to, but I'm not sure $ PERL6LIB="/tmp/" perl6 -e 'use v6.c; use test1; EXPORT::DEFAULT::.keys.say;' ... I don't think this is supposed to happen; you should get test1::EXPORT::DEFAULT $ PERL6LIB="/tmp/" perl6 -e 'use v6.c; use test1; test1::EXPORT::DEFAULT::.keys.say;' Could not find symbol '&DEFAULT' But, despite this, the Fpa class does seem to be available and the multis seem to be Now I'll assume you are using EXPORT::DEFAULT rather than just marking things as 4) I found that even with the candidates in your module available, Numeric's infix:<+> ...but without that extra candidate it still ends up in Numeric::infix<+>(\a, \b). $ PERL6LIB="/tmp/" perl6 --ll-exception -e 'use v6.c; use test1; EXPORT::DEFAULT::.keys.say; my Fpa $x = Fpa.new(); my Fpa $y = Fpa.new(); $y.var = 5; $x.var = 1; say $x.perl, ...this, however, might be a consequence of the value of the 'infix:<+>' constant Do note that the (Any:D I'd dig deeper but I must rest now. |
The RT System itself - Status changed from 'new' to 'open' |
From @AlexDanielGreat analysis! The first issue seems to be already mentioned in RT #126112 (and I vaguely recall one more ticket, but I'm failing to find it now). This ticket seems to be getting a bit unmanageable, please file smaller tickets for every issue you discover. On 2017-08-10 21:36:34, bri@abrij.org wrote:
|
Migrated from rt.perl.org#131785 (status was 'open')
Searchable as RT131785$
The text was updated successfully, but these errors were encountered: