Re: [Json] The names within an object SHOULD be unique.

Nico Williams <nico@cryptonector.com> Thu, 06 June 2013 22:44 UTC

Return-Path: <nico@cryptonector.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 9659921F99EC for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 15:44:13 -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]
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 Lp5ly2Dhywel for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 15:44:08 -0700 (PDT)
Received: from homiemail-a98.g.dreamhost.com (caiajhbdcbbj.dreamhost.com [208.97.132.119]) by ietfa.amsl.com (Postfix) with ESMTP id A7DA321F99E9 for <json@ietf.org>; Thu, 6 Jun 2013 15:44:06 -0700 (PDT)
Received: from homiemail-a98.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a98.g.dreamhost.com (Postfix) with ESMTP id 6300B2C206E for <json@ietf.org>; Thu, 6 Jun 2013 15:44:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:cc:content-type; s=cryptonector.com; bh=brTTKr/yE7rqNZVya9Hq 1KVnDbc=; b=bV9quY/sO1j3Y+XKkD8g33YYVP5tmGHaj/BM+ISROOvcapO1vTgD XuV+yUOgOMkVUiOj25JiB9oC/dc/Qiw4etE4pAqSEOJdmBUIv93JPLPv3vGwPj4p elA8Mo5SyxZaX6pgtMfEL3HPSQ+fBHynkXoAURNkp/JyRpC1awtKEv8=
Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by homiemail-a98.g.dreamhost.com (Postfix) with ESMTPSA id 11EB12C2059 for <json@ietf.org>; Thu, 6 Jun 2013 15:44:05 -0700 (PDT)
Received: by mail-we0-f171.google.com with SMTP id m46so2551706wev.16 for <json@ietf.org>; Thu, 06 Jun 2013 15:44:04 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=EueSDYSe102qYtKflL/TkUrkWKVMGVrdhY21vB0s+CQ=; b=deQP0HkXKIJ8iR+gpkm6yf5F9Nk7gTIzrgUzkO2drTCPfa9ijwdCpw1ltuO3vp8Lvv 2KizvdLAiHFO6zVntTtRSx0LuAKXVxYPvjuYnsWDrzM1YOn+qNpcQWYN41WZ1CNnj8Et 8kZ+gNe6gqLD6t1n+Zogg41IAlDmrnNZf0PJew5or/cTw+/oqyQX7s20NRa+uViAAwT0 j09M1y1+c1vH/UorRlrdgp4Z3W3GnJioBXKwbHT/jdBfmr0zlLhfiCmlqBIgZFPvd2S5 L2kzGS9FJ4Jj8hIGTM7BGqrm75FiG5YoElfw8RvjpZ8rW/54ATE1BZg3ZX4mW62zafBU Wgiw==
MIME-Version: 1.0
X-Received: by 10.181.12.1 with SMTP id em1mr173974wid.4.1370558644820; Thu, 06 Jun 2013 15:44:04 -0700 (PDT)
Received: by 10.216.63.136 with HTTP; Thu, 6 Jun 2013 15:44:04 -0700 (PDT)
In-Reply-To: <20130606223711.GN3090@mercury.ccil.org>
References: <51AF8479.5080002@crockford.com> <CAK3OfOgtYoPRZ-Gj5G8AnNipDyxYs=6_KD=rQTxKbhDPX6FZNA@mail.gmail.com> <20130606223711.GN3090@mercury.ccil.org>
Date: Thu, 06 Jun 2013 17:44:04 -0500
Message-ID: <CAK3OfOgdSgvwnTz_+E1ugjh1-gX16ETjHfEO8sZabWgjNgB-FA@mail.gmail.com>
From: Nico Williams <nico@cryptonector.com>
To: John Cowan <cowan@mercury.ccil.org>
Content-Type: text/plain; charset="UTF-8"
Cc: Douglas Crockford <douglas@crockford.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] The names within an object SHOULD be unique.
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: Thu, 06 Jun 2013 22:44:14 -0000

On Thu, Jun 6, 2013 at 5:37 PM, John Cowan <cowan@mercury.ccil.org> wrote:
> Nico Williams scripsit:
>
>> Thinking of encoders that do not have full knowledge of an object as
>> it is encoded, I'm uncomfortable with saying "MUST NOT send duplicate
>> keys", since determining whether a given key has already been sent
>> might require large amounts of state.  But note that this concern also
>> applies to parsers!
>
> The amount of state can be reduced probabilistically by storing hashes
> of the values rather than the values themselves.

Or a refinement: Bloom filters.  But I don't think that's a good idea.
 For one the parser would still have to grow the filter (with
adaptable Bloom filters) as it gets too big.  For another, we have the
risk of false positives.  Finally, such a parser could at best produce
an error on [suspected] duplicate key (excuse me, name) usage -- it
could not prevent the *first* value from being used, and if the
consumer has already taken some action based on the first value then
we suddenly have a conflict vis-a-vis parsers that accept only the
last value.  I'd rather accept that streaming parsers can do nothing
about duplicate names.

Nico
--