Re: [Json] Proposed minimal change for duplicate names in objects

Eliot Lear <> Wed, 03 July 2013 06:57 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 87ACD11E8166 for <>; Tue, 2 Jul 2013 23:57:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -110.331
X-Spam-Status: No, score=-110.331 tagged_above=-999 required=5 tests=[AWL=0.268, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8, USER_IN_WHITELIST=-100]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 1nefrLjdStir for <>; Tue, 2 Jul 2013 23:57:26 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 0C58811E8168 for <>; Tue, 2 Jul 2013 23:57:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;;; l=2754; q=dns/txt; s=iport; t=1372834646; x=1374044246; h=message-id:date:from:mime-version:to:cc:subject: references:in-reply-to:content-transfer-encoding; bh=Fny5qZ0RSDKcPAxekgZZmZhLfPZu1TqYRMC2qRRWqAk=; b=WZbBm+sxJph8UoieeW1E5IzTANx45MYMx4/I3TBfzLH5QVXtemA2kPTB kjvdzacUWid7mYQ/WeER0kxPcL6tDJtZ3teMCLECZ6jc+Gs23Ip2E2OFv mg2ykWieSsX4haqsCfX/YbdsAnX501kTHM71U9wYMa9hSTWlSqT2lsNxc g=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-AV: E=Sophos;i="4.87,986,1363132800"; d="scan'208";a="14783660"
Received: from ([]) by with ESMTP; 03 Jul 2013 06:57:24 +0000
Received: from mctiny.local ([]) by (8.14.5/8.14.5) with ESMTP id r636vMuC019790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Jul 2013 06:57:23 GMT
Message-ID: <>
Date: Wed, 03 Jul 2013 08:57:22 +0200
From: Eliot Lear <>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7
MIME-Version: 1.0
To: Nico Williams <>
References: <> <> <> <>
In-Reply-To: <>
X-Enigmail-Version: 1.5.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: Paul Hoffman <>, " WG" <>
Subject: Re: [Json] Proposed minimal change for duplicate names in objects
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 03 Jul 2013 06:57:31 -0000

Hi Nico,

On 7/3/13 8:45 AM, Nico Williams wrote:
> On Wed, Jul 3, 2013 at 1:35 AM, Eliot Lear <> wrote:
>>> In short, for streaming parsers (and generators) there's nothing we can do.
>>> What we can do is RECOMMEND that a) generators not produce duplicates
>>> (and explain how streaming ones cannot prevent dups), and b) that
>>> parsers use the last name (and explain how streaming ones will produce
>>> all dups).
>> To me this isn't strong enough.  I have some sympathy for both the
>> existing base and for parsers, but generators as an architectural
>> component should generate unambiguous output, streaming or otherwise.
>> And that follow's Postel's Law:
> How can a streaming generator do that?  The API for one might look like:
> ObjectStart(context)
> ObjectAdd(context, name, value)
> ...
> There's no way a minimal-state streaming generator (but I repeat
> myself; the whole point of a streaming interface is to keep minimal
> state :) can detect duplicates with O(1) state (probabilistic
> structures with false positives won't be acceptable either).

You've got to retain state.  You don't have to retain the value, but you
do have to retain the name.  It's O(k), and knowing you I know you're
smart enough to approach that (because I am and so I'm using inductive
theory ;-).  And I'll bet you a nickel that this is not going to be
anyone's high order bit.
>> "In general, an implementation must be conservative in its sending
>> behavior, and liberal in its receiving behavior."
> I've seen this maligned too.  How many times have we heard this as a
> root cause of security vulnerabilities on receiver sides?  We should
> be much more exacting, but in *this* case we can't be.

That's a fair point about security, but even in THAT context one should
be conservative in what one sends.  And yes we CAN be more exacting, but
at a cost.  What we're debating is the cost of ambiguity.

> It's not a question of what is ideal...  If we were starting from
> scratch we might forbid O(1) state generators and even parsers.  But
> it's too late for that and we have consensus to achieve.

Nothing to be done about installed base, as I wrote.  Let's write down
what the right thing to do is.  These are RFCs we're generating, now laws.
> BTW, we're retreading.  We should try not to, but it's difficult to
> avoid as no one can have read *every* post since the WG's inception.
> I think it's fair to say that on this issue there's no consensus to
> ban the bad behavior (duplicate names).  Please don't blame me for
> that lack of consensus.

WGs often retread.  Sometimes we find ways to get around our blocks.  We
both have no time for blame.