Re: [Json] Doofus Parameter Labels

Wendy Roome <w.roome@alcatel-lucent.com> Mon, 30 March 2015 20:04 UTC

Return-Path: <w.roome@alcatel-lucent.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3DDBE1A886D for <json@ietfa.amsl.com>; Mon, 30 Mar 2015 13:04:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.21
X-Spam-Level:
X-Spam-Status: No, score=-4.21 tagged_above=-999 required=5 tests=[BAYES_50=0.8, RCVD_IN_DNSWL_HI=-5, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b7fz3VAGHNiD for <json@ietfa.amsl.com>; Mon, 30 Mar 2015 13:04:31 -0700 (PDT)
Received: from smtp-fr.alcatel-lucent.com (fr-hpida-esg-02.alcatel-lucent.com [135.245.210.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 551271A1B62 for <json@ietf.org>; Mon, 30 Mar 2015 13:04:31 -0700 (PDT)
Received: from us70uusmtp3.zam.alcatel-lucent.com (unknown [135.5.2.65]) by Websense Email Security Gateway with ESMTPS id 38166AE10EDD4; Mon, 30 Mar 2015 20:04:25 +0000 (GMT)
Received: from umail.lucent.com (umail.ndc.lucent.com [135.3.40.61]) by us70uusmtp3.zam.alcatel-lucent.com (GMO) with ESMTP id t2UK4Qmr012283 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 Mar 2015 16:04:27 -0400
Received: from [135.222.152.71] (wdr-i7mbp2.mh.lucent.com [135.222.152.71]) by umail.lucent.com (8.13.8/TPES) with ESMTP id t2UK4OTE024083; Mon, 30 Mar 2015 15:04:25 -0500 (CDT)
User-Agent: Microsoft-MacOutlook/14.4.8.150116
Date: Mon, 30 Mar 2015 16:04:32 -0400
From: Wendy Roome <w.roome@alcatel-lucent.com>
To: Phillip Hallam-Baker <phill@hallambaker.com>, JSON WG <json@ietf.org>
Message-ID: <D13F2226.1F3612%w.roome@alcatel-lucent.com>
Thread-Topic: [Json] Doofus Parameter Labels
References: <CAMm+Lwg7UBJO83BN1xBbVsbzgeXa1pbhtiTcPKmMgFX3HcvQEw@mail.gmail.com>
In-Reply-To: <CAMm+Lwg7UBJO83BN1xBbVsbzgeXa1pbhtiTcPKmMgFX3HcvQEw@mail.gmail.com>
Mime-version: 1.0
Content-type: text/plain; charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/j67VQm7j7zpAsEPvp7gqe9oVYrY>
Subject: Re: [Json] Doofus Parameter Labels
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
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: Mon, 30 Mar 2015 20:04:33 -0000

It would help if you told us which draft and which code generator you are
using.

My first reaction is that if the code generator is supposed to generate
real code that you can feed directly into a compiler, then the code
generator should ensure that it generates legal code. Eg, if it maps a
protocol field into a variable, the code gen should transmogrify the
protocol field name into a valid variable name. Simplest solution is to
slap a fixed prefix, like m_, onto every generated variable, and replace
non-alpha-num chars with _.

My second reaction is why canĀ¹t you do that yourself?

	- Wendy Roome


On 03/30/2015, 15:38, "Phillip Hallam-Baker" <phill@hallambaker.com> wrote:

>So, I am implementing an IETF draft which is fairly widely used and
>using a code generator to speed things along.
>
>The code is breaking because the spec has decided to use 'protected'
>as a tag which is of course a reserved keyword in Java, C# and much
>else.
>
>OK so there is an escape feature that I can use instead. But those
>don't exist in other languages. And then I come across a tag that has
>a non alphanumeric tag value.
>
>
>This sort of thing is likely to be happening quite a bit now that
>people are using JSON and it would be a lot better if we could avoid
>it. The fact that JSON allows tags to be any valid UNICODE sequence
>does not mean that all choices are equal.
>
>In general it would be good if people writing specs could stick to the
>identifier naming rules for C and avoid reserved words from Java, C#,
>etc. The languages and tools I use are quite capable of using accented
>characters. I have absolutely no clue how to generate them on the
>keyboard though.
>
>_______________________________________________
>json mailing list
>json@ietf.org
>https://www.ietf.org/mailman/listinfo/json