On Sun, Apr 13, 2014 at 6:18 PM, <[email protected]> wrote:

> Am Freitag, 4. April 2014 00:45:37 UTC+2 schrieb [email protected]:Hi
>> Julia users,
>>
>> - array indexing: introduce with negative number -1,-2,... (instead of or
>> additionally to end, end-1)
>>
> No comments on that?
>
> Negative indexing is a misfeature. It takes something static – "I want to
index from the end, not the beginning" – and encodes it with run-time
information – i.e. the sign of the index. Neither the programmer nor the
compiler knows whether an expression like v[k] is doing indexing from the
beginning or the end. In practice, v[k] usually means indexing from the
beginning while v[-k] usually means indexing from the end, but you can't be
sure since k might be negative. In the expression v[end-k], on the other
hand, the runtime value of k doesn't change the meaning at all.

Reply via email to