Skip Menu |

Subject: [BUG] Some Method objects use wrong .gist method
Download (untitled) / with headers
text/plain 1.6k
Method objects have their own `.gist` method[^1] that just print `.name`. However, under some circumstances, that method is lost, and `Mu::gist` is used instead: <Zoffix__> m: <z>.comb.^methods.grep(*.name eq 'eager').say <camelia> rakudo-moar 7af339: OUTPUT: «(Method+{<anon|61058032>}.new)␤» I tried to fix it and failed, but found some facts about the bug that might give a hint: *) The problematic methods has `is nodal` trait on them (which mixes in a role), but NOT all nodal methods have this issue *) (90% sure this is what happened) If you add an only `method z is nodal {}` to src/core/Any.pm, the bug doesn't appear *) If you add a `multi method z is nodal {}` to src/core/Any.pm the bug occurs *) If you do the same thing with a regular class, it doesn't happen. BTW: `Any` is augmented in core *) .file on the method gives src/core/Method.pm. However, if you modify Mu.gist to append some string, you'll see that it's Mu's method that gets called. <Zoffix__> m: my $m = <z>.comb.^methods.grep(*.name eq 'eager').head; dd $m.^lookup('gist').cando(\($m)).head.file <camelia> rakudo-moar 7af339: OUTPUT: «"SETTING::src/core/Method.pm"␤» *) Even if you make Method.gist an `only` method, the Mu::gist one is still the one that gets called *) If you implement only or multi method `gist` in the role that `is nodal` mixed in[^2], trying to call .gist on the buggy method gives "Cannot invoke this object (REPR: Null; VMNull)" [1] https://github.com/rakudo/rakudo/blob/045ef448b62c045630abb8e167cc45d1f9fe6902/src/core/Method.pm#L4 [2] https://github.com/rakudo/rakudo/blob/7af339b91d2a56a4a4eb065952cd548c188bd124/src/core/traits.pm#L357


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