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

Carsten Bormann <cabo@tzi.org> Sun, 07 July 2013 19:03 UTC

Return-Path: <cabo@tzi.org>
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 B1F4411E80EE for <json@ietfa.amsl.com>; Sun, 7 Jul 2013 12:03:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.149
X-Spam-Level:
X-Spam-Status: No, score=-106.149 tagged_above=-999 required=5 tests=[AWL=0.100, BAYES_00=-2.599, HELO_EQ_DE=0.35, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 Edlgt0daz1nP for <json@ietfa.amsl.com>; Sun, 7 Jul 2013 12:03:18 -0700 (PDT)
Received: from informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) by ietfa.amsl.com (Postfix) with ESMTP id 9BED421F9AA2 for <json@ietf.org>; Sun, 7 Jul 2013 12:03:18 -0700 (PDT)
X-Virus-Scanned: amavisd-new at informatik.uni-bremen.de
Received: from smtp-fb3.informatik.uni-bremen.de (smtp-fb3.informatik.uni-bremen.de [134.102.224.120]) by informatik.uni-bremen.de (8.14.4/8.14.4) with ESMTP id r67J3D1e016000; Sun, 7 Jul 2013 21:03:13 +0200 (CEST)
Received: from [192.168.217.105] (p54890C27.dip0.t-ipconnect.de [84.137.12.39]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp-fb3.informatik.uni-bremen.de (Postfix) with ESMTPSA id 5C25036F9; Sun, 7 Jul 2013 21:03:13 +0200 (CEST)
Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\))
Content-Type: text/plain; charset="iso-8859-1"
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <20130707184322.GA16880@mercury.ccil.org>
Date: Sun, 07 Jul 2013 21:03:12 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <9CD89FF5-59DF-454E-BFCF-C0EE99933457@tzi.org>
References: <00cd01ce7a9f$19adeaa0$4d09bfe0$@augustcellars.com> <00d701ce7aa6$cc5fe700$651fb500$@augustcellars.com> <CAK3OfOiWrWCvNQneokyycV1Jb98M=UR-U7z0dhxUjzVdf+PwDw@mail.gmail.com> <CAHBU6itdi3B1rWv2TiOYhL1QuOVxrFKt7OTWRoG+6TgV8Bc_uw@mail.gmail.com> <CAK3OfOgOYA5fas0oomF5amjP1bR5F=0+uve7mFD4=FMoEV7sWg@mail.gmail.com> <CAGrxA24y4D62XY-YnbDvKVwNKUickcEFxv1FUhc_yqG4KP-m-w@mail.gmail.com> <CAHBU6iuWLcXv0QKR=Ow8gkzoZLmoZjqYCqXDXR8FLVb7w7M2Tw@mail.gmail.com> <CAGrxA252xregfKViPOH7ustTSwOoorrffwdbUuCrryVxmqHUNw@mail.gmail.com> <20130707180955.GA11346@mercury.ccil.org> <18CB0DCA-36FA-4900-9A56-43ECECF2A21A@tzi.org> <20130707184322.GA16880@mercury.ccil.org>
To: John Cowan <cowan@mercury.ccil.org>
X-Mailer: Apple Mail (2.1508)
Cc: "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
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 19:03:24 -0000

On Jul 7, 2013, at 20:43, John Cowan <cowan@mercury.ccil.org> wrote:

> Carsten Bormann scripsit:
> 
>> In many JSON designs, the receiver knows the full set of keys ahead
>> of time.  In this case, you are better off with conditionally interning
>> it (i.e., if I already have the symbol, return it, otherwise keep the
>> string around, now we know that it didn't map to a known key).
> 
> I don't know any way to do that in Java, because there seems to be no
> way to ask if a string is interned except by interning it.

No idea about Java, but same problem at the language level in Ruby.
However, at the C API level, there is a conditional intern (rb_check_id()).
Too bad that this isn't exported to the Ruby level.

Grüße, Carsten