On Thu Mar 19 06:28:19 2009, masak wrote: > <amoc> rakudo: my @a = <one two>; @a[-1] = 'zero'; @a.perl > <p6eval> rakudo f8b6ae: RESULT«"[\"one\", \"two\"]"» > <amoc> it is a bug, right? > <masak> amoc: [*-1] > <amoc> rakudo: my @a = <one two>; @a[*-1] = 'zero'; @a.perl > <p6eval> rakudo f8b6ae: RESULT«"[\"one\", \"zero\"]"» > <masak> S09. > <jnthn> I think -1 is meant to be a syntax error these days. > <masak> jnthn: why? > <masak> it's just out of bounds. > <jnthn> std: @foo[-1] > <p6eval> std 25906: OUTPUT«##### PARSE FAILED #####Obsolete use of > [-1] subscript to access final element; in Perl 6 please use [*-1] > instead [...] > <amoc> from > http://perlcabal.org/syn/S09.html#Negative_and_differential_subscripts > <masak> oh. > <amoc> it says: "Using a standard index less than zero prepends the > corresponding number of elements to the start of the array and then > maps the negative index back to zero"? > <jnthn> masak: Because STD.pm says so. But yes, you can declare an > array with different indexes too... > <jnthn> So I'm not sure what'd happen there. > <masak> shall I report this as a rakudobug? > <jnthn> You can. We're inconsistent with STD.pm there, so it's > probably worthy of a ticket. > <masak> someone put together an example for STD with a > different-indexes array, and see what it says! :) > * masak submits
This currently fails, but not in the same manner as STD: 17:26 < [Coke]> rakudo: my @a = <one two>; @a[-1] = 'zero'; @a.perl 17:26 <+p6eval> rakudo ac8a2a: OUTPUT«Cannot modify readonly value in '&infix:<=>' at line 1 in main program body at line 22:/tmp/Udd9hXZOxN» -- Will "Coke" Coleda