于 2010年09月09日 03:44, Joe Rahmeh (via RT) 写道:
# New Ticket Created by Joe Rahmeh
# Please include the string: [perl #77738]
# in the subject line of all future correspondence about this issue.
#<URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77738>
1. Rakudo version:
This is Rakudo Perl 6, version built on parrot 2.7.0 r48768
2. Code that caused the bug:
sub incr3 (*...@v is rw) { for @v -> $x { $x++} }
I think you should write this line as this:
sub incr3 (*...@v is rw) { for @v -> $x is rw { $x++ } }
my ($a, $b) = (0, 0);
incr3($a, $b);
say "incr3: $a, $b";
3. Output:
Cannot modify readonly value
in '&infix:<=>' at line 1
in<anon> at line 7071:CORE.setting
in 'incr3' at line 1
in main program body at line 3:a3.1
4. Expected behavior: Code should have compiled without any errors
It should have produced following output:
incr3: 1 1