On 17 December 2012 11:54, Barry Leiba <barryle...@computer.org> wrote:
>> Might I suggest, however, using -1 instead of "-" to refer to the last item 
>> in an
>> array, as this provides two benefits:
>>
>> 1) Allows for adding the complexity down the road in a compatible way, should
>>    there be need
>> 2) Uniformity; i.e. always using integer values for referring to array 
>> elements.
>
> I have to say that this suggestion sounds very compelling to me, for
> both reasons.  I know there's a bunch of running code out there, but
> this (and perhaps teasing apart the "add" and "insert" concepts into
> separate verbs) seems worth the bother.

This is true, it does sound compelling.

There will, no doubt, be questions about why -2 doesn't work.  It's
tempting to implement -2 and -3, so you might have to explain why that
is a bad idea.

index = (index + length) % length

Reply via email to