This works now:

> sub incr1 (*@v is rw) { @v[0]++; @v[1]++; }; my ($a, $b) = (0, 0); incr1($a, 
> $b); say "incr1: $a, $b";
incr1: 1, 1

> sub incr2 (*@v is rw) { for @v { $_++} }; my ($a, $b) = (0, 0); incr2($a, 
> $b); say "incr2: $a, $b";
incr2: 1, 1

> sub incr3 (*@v is rw) { for @v -> $x is rw { $x++ } }; my ($a, $b) = (0, 0); 
> incr3($a, $b); say "incr3: $a, $b";
incr3: 1, 1

> sub incr3_old (*@v is rw) { for @v -> $x { $x++} }; my ($a, $b) = (0, 0); 
> incr3_old($a, $b); say "incr3_old: $a, $b";
Cannot assign to a readonly variable or a value

I added tests to S04-statements/for.t with the following commit: 
https://github.com/perl6/roast/commit/c58e1975f5

Reply via email to