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
augment(or supersede, NYI) doesn't work on non-global classes #1746
Comments
From @zhuomingliangJimmyZ> rakudo: my class bar { method Str() { '11'; }; }; multi sub foo(bar $x as Int is copy) { say ++$x }; augment class bar { method Int() { '10' }}; foo(bar.new()); p6eval> rakudo 1eef08: OUTPUT«Can't augment class bar without 'use MONKEY_TYPING'â�¤current instr.: 'perl6;Perl6;Grammar;add_name' pc 42888 (src/gen/perl6-grammar.pir:353)â�¤Â» JimmyZ> rakudo: my class bar { method Str() { '11'; }; }; multi sub foo(bar $x as Int is copy) { say ++$x }; my augment class bar { method Int() { '10' }}; foo(bar.new()); JimmyZ> rakudo: my class bar { method Str() { '11'; }; }; multi sub In order to discourage casual misuse of these declarators, they are not å�¨æ¤ç¥�ä½ èº«ä½�å�¥åº·ï¼�天天快ä¹�
|
From @cokeOn Wed May 05 00:22:54 2010, jimmy wrote:
This appears to do something closer to the right thing now: If you remove the "my" from the augment: 19:18 <[Coke]> rakudo: use MONKEY_TYPING;my class bar { method Str() { '11'; }; It allows the augment and then complains about the '10' you passed to ++ This matches with a straight sub that does the same thing: 19:21 <[Coke]> rakudo: sub foo (Int $x as Str) { say $x.WHAT}; foo(3) So I think this is closable modulo tests. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @moritzNow tested in S12-class/augment-supersede.t. |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#74910 (status was 'resolved')
Searchable as RT74910$
The text was updated successfully, but these errors were encountered: