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

Stephan Beal <sgbeal@googlemail.com> Sun, 07 July 2013 18:09 UTC

Return-Path: <sgbeal@googlemail.com>
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 D6F6221F9446 for <json@ietfa.amsl.com>; Sun, 7 Jul 2013 11:09:38 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.977
X-Spam-Level:
X-Spam-Status: No, score=-1.977 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, NO_RELAYS=-0.001]
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 aeBgoTnLPlA9 for <json@ietfa.amsl.com>; Sun, 7 Jul 2013 11:09:38 -0700 (PDT)
Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) by ietfa.amsl.com (Postfix) with ESMTP id 977DE21F91CE for <json@ietf.org>; Sun, 7 Jul 2013 11:09:37 -0700 (PDT)
Received: by mail-wi0-f172.google.com with SMTP id c10so8397640wiw.11 for <json@ietf.org>; Sun, 07 Jul 2013 11:09:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=IXDJYONJAPHpP4SgqYnQ6FapfViQCQz2LGvhP2Qod1I=; b=RVRpII7A4mDd3Qg9avhMAwXHmv203fi6ulYq/IBvjxuCLh9MgN0xQ5qDYeP49SfZst WaE/XaUD43jskJzWWtUF2jr1MIjBzEW3qceYcbCqYCwNEfSUHk/wTC0grVvlDUGdkDf5 JOhJzhKf5bk+kv9n9qWMV+1ZRezcBagzEXthW+NqETc3GUGpvKUykehxilrgoJLBld+U rC28NML1o3Hd2B3aD7lK9ZiEb4aQBEtUri/AgUTV91h56iYuLhe/0460dUmlCrFRD/ya /Xmh8KFSXqYQe30pCgJmYfPe9q5FJdReuQfE6suk1JQBTwzyTm2t8Ew045rXMO53cHR+ R45Q==
MIME-Version: 1.0
X-Received: by 10.180.82.196 with SMTP id k4mr12198427wiy.0.1373220576707; Sun, 07 Jul 2013 11:09:36 -0700 (PDT)
Received: by 10.194.1.241 with HTTP; Sun, 7 Jul 2013 11:09:36 -0700 (PDT)
In-Reply-To: <CAK3OfOiWrWCvNQneokyycV1Jb98M=UR-U7z0dhxUjzVdf+PwDw@mail.gmail.com>
References: <B86E1D4B-1DC8-4AD6-B8B3-E989599E0537@vpnc.org> <CAK3OfOj3MNNhjwo2bMa5CgoqynzMRVvviBXC8szxt5D17Z7FDg@mail.gmail.com> <51D3C63C.5030703@cisco.com> <51D48023.1020008@qti.qualcomm.com> <20130703201143.GL32044@mercury.ccil.org> <00cd01ce7a9f$19adeaa0$4d09bfe0$@augustcellars.com> <00d701ce7aa6$cc5fe700$651fb500$@augustcellars.com> <CAK3OfOiWrWCvNQneokyycV1Jb98M=UR-U7z0dhxUjzVdf+PwDw@mail.gmail.com>
Date: Sun, 7 Jul 2013 20:09:36 +0200
Message-ID: <CAKd4nAhMfz_NAFL4YmLFX_=69JizWoPvLac+1_yr0K2LJap3DQ@mail.gmail.com>
From: Stephan Beal <sgbeal@googlemail.com>
To: "json@ietf.org" <json@ietf.org>
Content-Type: multipart/alternative; boundary=f46d044281ceac4e5804e0efd4e0
Subject: Re: [Json] Proposed minimal change for duplicate names in objects
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
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: Sun, 07 Jul 2013 18:09:38 -0000

On Sun, Jul 7, 2013 at 3:20 AM, Nico Williams <nico@cryptonector.com> wrote:

> We still need to decide (directly or indirectly) whether to impose dup
> name checking on all JSON parsers, even minimal-state streaming
> parsers, whether we want to impose a requirement on the parser and the
> application (so we need not mention streaming), or on the parser if
> it's not a streaming parser *and* the application if the parser is
> streaming.
>

FWIW, as a JSON library implementor, i can say that a MUST on the whole
duplicate keys issue is not going to be enforced in any of my impls. Having
to check for an existing key on every insert turns O(N) operations in to
catastrophically poor operation if the property store is not fast (and JSON
has no business specifying performance characteristics). e.g. my JSON
libraries tend to use simple key/value pair _lists_, not maps, because the
nature of JSON is (for most apps) such that it's spit out and slurped in,
but not manipulated as the basic data structure (at least not in C, where
i'm working). Streaming or not, enforcing the implied level of
infrastructure and potential performance hits which MUST  implies is not
something i plan on doing, even if it means not being fully compliant.
"Duplicate keys lead to unspecified behaviour," end of story.

names.  We've had at least a number of examples of streaming parsers
> that cannot implement such a requirement -- the whole point of
> streaming being nullified by state-keeping requirements like this one.
>  So we'd have to explicitly decide that we don't want to allow minimal
> state streaming parsers.  Might as well call for consensus on that.
>

i'm for not splitting them into categories, as this document really has no
business (IMO) specifying that level of implementation detail. Specify the
duplicate keys as poor practice leading to
unspecified/implementation-defined behaviour, and be done it.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal