# New Ticket Created by  Christian Bartolomaeus 
# Please include the string:  [perl #127913]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127913 >


The following discussion from november 2015 was linked in ticket
https://rt.perl.org/Ticket/Display.html?id=125784 which I'm going
to close.

I'm opening this separate ticket for the differing behaviour 
of rakudo-moar and rakudo-jvm with regard to using a negative
startposition for index (and rindex).

<bartolin> lizmat: earlier today I found this differing behaviour 
for moar and jvm:
<bartolin> r: say index("xxy", "y", -1)
<camelia> rakudo-moar: OUTPUT«Nil␤»
<camelia> ..rakudo-jvm 0b6328: OUTPUT«2␤»
<bartolin> do you think moar is right here?
* lizmat looks into it
<bartolin> lizmat++
<lizmat> r: use nqp; say nqp::index("xxy","y",-1)
<camelia> rakudo-jvm 0b6328: OUTPUT«2␤»
<camelia> ..rakudo-moar: OUTPUT«-1␤»
<lizmat> looks like a difference in implementation of nqp::index
<lizmat> r: use nqp; say nqp::index("xxy","y",0)
<camelia> rakudo-moar, rakudo-jvm 0b6328: OUTPUT«2␤»
<lizmat> bartolin: seems worthy of an NQP ticket
<lizmat> or perhaps just a rakudobug  :-)
<bartolin> lizmat: and what do you think is the "better" answer? 
Perl 5 allows negative start positions, if I'm not mistaken.
<lizmat> yes, but P5 also allows to use -1 to indicate from end
<lizmat> so perhaps it should just fail on a negative position
<bartolin> I see. I'll open a RT for this (probably a bit later).
<bartolin> thanks for looking!

Reply via email to