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

Parent types augmented at run time no longer make augmented methods available to sub types #3040

Closed
p6rt opened this issue Feb 2, 2013 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Feb 2, 2013

Migrated from rt.perl.org#116613 (status was 'resolved')

Searchable as RT116613$

@p6rt
Copy link
Author

p6rt commented Feb 2, 2013

From @thundergnat

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

@p6rt
Copy link
Author

p6rt commented Feb 5, 2013

From @thundergnat

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.

@p6rt
Copy link
Author

p6rt commented Jun 27, 2013

From @FROGGS

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␤»

@p6rt
Copy link
Author

p6rt commented Jun 27, 2013

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

@p6rt
Copy link
Author

p6rt commented Oct 27, 2015

From @coke

On Thu Jun 27 00​:36​:55 2013, FROGGS.de wrote​:

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

@p6rt
Copy link
Author

p6rt commented Apr 7, 2016

From @diakopter

works now

@p6rt
Copy link
Author

p6rt commented Apr 7, 2016

@diakopter - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant