ietf
[Top] [All Lists]

Re: draft-ietf-appsawg-json-pointer-07 - array index for end ofarray

2012-12-17 16:31:41
On 17 December 2012 11:54, Barry Leiba <barryleiba(_at_)computer(_dot_)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