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


<masak> rakudo: say (my @a).end
<p6eval> rakudo 142d22: OUTPUT«-1␤»
<masak> S32 says: "Returns the final subscript of the first dimension;
for a one-dimensional array this simply the index of the final
element."
* masak submits rakudobug
<masak> huh. I didn't even see the missing "is" in that second
sentence before :)
<jnthn> masak: huh. If there's nothing in there, what do you want it to return?
<jnthn> 0 would be wrong because that'd imply there's one thing in there.
<masak> jnthn: I don't know. but it's not to spec right now.
<masak> jnthn: maybe Failure.
<lue> but -1 could be in a list as well.
<masak> lue: if you say that, you've misunderstood the purpose of .end
(just like I did first time I saw it)
<jnthn> masak: I think you maybe need to explain it then. :)
<jnthn> masak: 'cus I suspect I'm missing something also...
<masak> well, first off, let's agree on what S32 actually *says*.
<masak> it says "returns the final *subscript*.
<masak> an empty array has no final subscript.
<masak> hence -1 is *wrong*.
<jnthn> Hm
<jnthn> True
<jnthn> It may be a handy sentinel if you planeed to do some math on it.
<masak> if S32 said "returns less than the length of the array", -1
would have been fine.
<jnthn> But yeah, I can see flagging it up as a Failure is probably better.
<masak> but it doesn't.
<masak> so it isn't.
<masak> this is why we have a spec, for precision and clarity.
<masak> in this case, it's precise and clear. hence, bug.
<masak> if you want -1, please use C<+...@a - 1> :)
<jnthn> fairy nuff.

Reply via email to