ietf
[Top] [All Lists]

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

2012-12-17 19:56:07
ISTM that if the person constructing the pointer wants to append 
to an array and knows the size of the array (as pointed out in 
another thread) he should be able to use "/foo/<len>" where <len> 
is the index of the element just after the last existing one in 
the array. No need for "/foo/-" or any negative integers. The only 
requirement is to allow that one extra index to be used without 
error.


On Mon, 2012-12-17, Mark Nottingham wrote:
I disagree. Adding a capability for other indices down the
road is NOT compatible for existing uses, so adding it will
cause confusion ("are you using the old JSON Pointer or the new one?") and 
interop problems.

IIRC the discussion in the WG went much along these lines, and
led to us explicitly choosing a single character, rather than a
misleading "-1" construct. I'd be more comfortable with
changing the character to something even further away, rather
than making this construct even more confusing. 

The other way we could go would be to do full negative
indexing; we don't have any use cases for that, and it
increases complexity a bit, but at least it would be unsurprising.


On 18/12/2012, at 6:54 AM, Barry Leiba
<barryleiba(_at_)computer(_dot_)org> wrote:

This was discussed in the Working Group, but it wasn't felt that the added
complexity was worth it; there's a strong feeling that this spec should be 
as
simple as possible.

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.

Barry, as participant

--
Mark Nottingham   http://www.mnot.net/



-- 
Bill McQuillan <McQuilWP(_at_)pobox(_dot_)com>