Skip Menu |
Report information
Id: 125518
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: smls75 [at] gmail.com
Cc:
AdminCc:

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



Subject: NQPRoutine sneaking into Perl 6 land through the Grammar class
Some of the methods of the Grammar class (such as FAILGOAL and !cursor_pos) are exposed to Perl 6 code as NQPRoutine objects, which throw LTA exceptions when introspected in the usual Perl 6 ways: ➜ my $method = Grammar.^methods.first(*.name eq "!cursor_pos"); cannot stringify this ➜ say $method.name; FAILGOAL ➜ say $method ~~ Regex; Invocant requires a 'Failure' instance, but a type object was passed. Did you forget a .new? ➜ say $method.WHAT; Method 'gist' not found for invocant of class 'NQPRoutine' ➜ say $method.WHAT.^name; NQPRoutine This is a regression which caused the Grammar::Debugger module to break, because its overloaded Grammar.find_method($obj, $name) does a $meth ~~ Regex check. (It now checks against $method.WHAT.^name first as a workaround.) IRC comments: <jnthn> Yeah, that's the issue...the NQP object is sneaking into Perl 6 land. <jnthn> We'd kinda like the introspection to work out there <jnthn> they should in theory get exposed as a ForeignRoutine or so
Download (untitled) / with headers
text/plain 624b
The bug still exists in: This is Rakudo version 2016.07.1-97-g4ee1048 built on MoarVM version 2016.07-11-g11e02fe implementing Perl 6.c. Except that now the fist line already throws an exception: ➜ my $meth = Grammar.^methods.first({ .name eq "FAILGOAL" }).^name; X::TypeCheck::Binding exception produced no message in block <unit> at -e line 1 Apparently, .first can no longer deal with returning a NQPRoutine... :) One can use .^find_method to confirm that the underlying problem is still that NQPRoutine's are being leaked: ➜ say Grammar.^find_method("FAILGOAL").^name; NQPRoutine


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