> On 14 Apr 2017, at 10:29, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: >> On 11 Apr 2017, at 14:44, Eigil Skjæveland (via RT) >> <perl6-bugs-follo...@perl.org> wrote: >> >> # New Ticket Created by Eigil Skjæveland >> # Please include the string: [perl #131134] >> # in the subject line of all future correspondence about this issue. >> # <URL: https://rt.perl.org/Ticket/Display.html?id=131134 > >> >> >>> my Int @a = 1, 2; >>> my int @b = 1, 2; >>> say so @a[-1 ^ 0]; >> True >>> say so @b[-1 ^ 0]; >> False >>> say @a[-1 ^ 0]; >> Index out of range. Is: -1, should be in 0..^Inf >> in block <unit> at <unknown file> line 1 >> >>> say @b[-1 ^ 0]; >> one(2, 1) >> >> It seems the native int array treats negative indices in a junction as >> relative to the end of the array. > > Any expression resulting in a negative value at runtime, exposes this > behaviour: > > $ 6 'my int @a = ^10; my $a = 0; dd @a[$a-1]’ > 9 > > At the moment, this happens because the AT-POS candidate directly uses > nqp::atposref_i for performance reasons. > > Exactly for that reason, I don’t think we should fix this at the Perl 6 > level, because we would lose a *lot* of performance if we did.
Hmmm… the loss in performance appears to be in the 10% range, so maybe not as bad as I anticipated. Liz