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

Stefan Drees <stefan@drees.name> Wed, 03 July 2013 05:23 UTC

Return-Path: <stefan@drees.name>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3EF1A21F9CDE for <json@ietfa.amsl.com>; Tue, 2 Jul 2013 22:23:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.249
X-Spam-Level:
X-Spam-Status: No, score=-2.249 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HELO_EQ_DE=0.35]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fa2-y8ofLR65 for <json@ietfa.amsl.com>; Tue, 2 Jul 2013 22:22:54 -0700 (PDT)
Received: from mout.web.de (mout.web.de [212.227.15.14]) by ietfa.amsl.com (Postfix) with ESMTP id 3938621F9CDA for <json@ietf.org>; Tue, 2 Jul 2013 22:22:53 -0700 (PDT)
Received: from newyork.local.box ([93.129.117.152]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MgwO8-1UYIpc0ZFY-00M7Vm; Wed, 03 Jul 2013 07:22:49 +0200
Message-ID: <51D3B527.1090200@drees.name>
Date: Wed, 03 Jul 2013 07:22:47 +0200
From: Stefan Drees <stefan@drees.name>
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: John Cowan <cowan@mercury.ccil.org>
References: <B86E1D4B-1DC8-4AD6-B8B3-E989599E0537@vpnc.org> <20130703011128.GK31347@mercury.ccil.org>
In-Reply-To: <20130703011128.GK31347@mercury.ccil.org>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K0://+/mY7+Expro2qg8Op4aFmXMZXF0/eaGuDUPT8xuab4F5c+KN5 hCLCpXrSeGsvD1JIPDXLyCTcOhyTLFpJUVbttLkfVk1B87ZDyTyfHswAqTOPHnUz4wiaR5k vdLMhg+jVwq+O/PHjMpU2iFS7e8im86gnGz+X7bynbXpY4U+FN/BVBGSRF7r/6KqFJbNepX Q7OJ7sLNSaXz+GLH8IMwg==
Cc: Paul Hoffman <paul.hoffman@vpnc.org>, "json@ietf.org WG" <json@ietf.org>
Subject: Re: [Json] Proposed minimal change for duplicate names in objects
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: stefan@drees.name
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Jul 2013 05:23:00 -0000

I fully second the below points that John makes.

{"Stefan":true}
Am 03.07.13 03:11, schrieb John Cowan:
> Paul Hoffman scripsit:
>
>> Proposal 1:
>>
>> In section 2.2 (Grammar -> Objects):
>>    No change
>> In section 4 (Parsers):
>>    Add: "If a parser encounters an object with duplicate names, the parser MUST use only the last
>>    name/value pair that has the duplicate name.
>
> I object to this, because it is unclear what "use" means.  If it means
> "report to the application", then a streaming parser cannot do this
> without ceasing to be streaming: that is, it must buffer up the whole
> object in order to be sure not to report any inappropriate pairs.
> If "use" means something else, it must be explained more clearly.
>
>> In section 5 (Generators):
>>    Add: "The names within an object SHOULD be unique."
>
> I approve of this.  However, an additional sentence is required to explain
> which names are distinct and which are not.
>
>> Proposal 2:
>>
>> Same as Proposal 1 *except* that a second sentence is added for section 4: "A parser that streams
>>    its outputs MUST fail to finish parsing if it encounters more than one name/value pair with the
>>    same name."
>
> This puts only a slightly lower burden on streaming parsers: they now
> do not need to buffer up the whole object, but may report it on the fly,
> keeping track of the names already seen in order to fail if one of them
> is a duplicate.  I still think this burden is excessive.
>
> I therefore propose that nothing be said about parsers, but that generators
> SHOULD NOT generate duplicate names, where "duplicate" is defined to mean
> consisting of the same code points or scalar values, as the case may be,
> in the same order.
>