Skip Menu |
Report information
Id: 116613
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: thundergnat [at] comcast.net
Cc:
AdminCc:

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



Subject: Parent types augmented at run time no longer make augmented methods available to sub types
Date: Sat, 02 Feb 2013 09:46:40 -0500
To: rakudobug [...] perl.org
From: thundergnat <thundergnat [...] comcast.net>
Download (untitled) / with headers
text/plain 1.2k
Some time between Oct 2012 and Feb 2013 Rakudo stopped making methods added at run time available to derived types. It worked in beijing and in nom until recently. Same behaviour under Linux and Windows builds. $ perl6 -v This is perl6 version 2013.01-97-g6d5dc67 built on parrot 4.10.0 revision RELEASE_4_10_0 thundergnat: Is there a way in Rakudo to augment a parent type at run time and have the augmented method available to child types automatically? I know that used to "work" but it's entirely possible I was (ab)using unspecced behavior. :/ thundergnat: r: use MONKEY_TYPING; augment class Int { method foo (*@) { "foo" } }; say Int.foo; p6eval: rakudo 6d5dc6: OUTPUT«foo␤» thundergnat: r: use MONKEY_TYPING; augment class Cool { method foo (*@) { "foo" } }; say Int.foo; p6eval: rakudo 6d5dc6: OUTPUT«No such method 'foo' for invocant of type 'Int'␤ in block at /tmp/2jjKk3JKph:1␤␤» thundergnat: :( moritz: thundergnat: it should work, I think moritz: but it's tricky to do thundergnat: It did what I expected as late as 2012.10. I just updated to latest Rakudo and it no longer does. moritz: 2012.10 did it right? moritz: that's surpising thundergnat: Yes thundergnat: Should I file a bug report? I wasn't entirely sure that the change was unintended moritz: yes, please report
Download (untitled) / with headers
text/plain 736b
FWIW.... After some bisecting, it seems like this stopped working after commmit f0acedfc5a8a24a57b028843e6b2926dcf5172ab. It still works in commit 870d189bbc7362d1f07130024f6ebec0bb1a1a23. From git log: commit f0acedfc5a8a24a57b028843e6b2926dcf5172ab Author: jnthn <jnthn@jnthn.net> Date: Tue Oct 9 22:42:08 2012 +0200 Make the method cache authoritative in some cases. This makes it much cheaper for things that are doing can style checks, which is the case for grammars without any actions, .? and so forth. colomon++ for the profile that led to this. commit 870d189bbc7362d1f07130024f6ebec0bb1a1a23 Author: jnthn <jnthn@jnthn.net> Date: Sun Oct 7 21:24:15 2012 +0200 Run S05-modifier/perl5_5.t.
Download (untitled) / with headers
text/plain 410b
Here is a workaround that might imply a fix: r: use MONKEY_TYPING; augment class Cool { method foo (*@) { "foo" } }; say Int.foo; rakudo 5c0dae: OUTPUT«No such method 'foo' for invocant of type 'Int'␤ in block at /tmp/hBLEJlttbt:1␤␤» # augment child classes r: use MONKEY_TYPING; augment class Cool { method foo (*@) { "foo" } }; augment class Int { }; say Int.foo; rakudo 5c0dae: OUTPUT«foo␤»
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 787b
On Thu Jun 27 00:36:55 2013, FROGGS.de wrote: Show quoted text
> Here is a workaround that might imply a fix: > > r: use MONKEY_TYPING; augment class Cool { method foo (*@) { "foo" } }; > say Int.foo; > rakudo 5c0dae: OUTPUT«No such method 'foo' for invocant of type 'Int'␤ > in block at /tmp/hBLEJlttbt:1␤␤» > > # augment child classes > r: use MONKEY_TYPING; augment class Cool { method foo (*@) { "foo" } }; > augment class Int { }; say Int.foo; > rakudo 5c0dae: OUTPUT«foo␤»
Additionally: 14:17 < [Coke]> r: use MONKEY-TYPING; augment class Cool { method foo (*@) { "foo" } }; Cool.^compose; Int.^compose; say Int.foo 14:17 <+camelia> rakudo-{moar,jvm} 962197: OUTPUT«foo␤» See also: http://irclog.perlgeek.de/perl6/2015-10-15#i_11379856 -- Will "Coke" Coleda
works now


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