# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #63986]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=63986 >


<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

Reply via email to