Re: [Json] Doofus Parameter Labels

Wendy Roome <> Mon, 30 March 2015 20:04 UTC

Return-Path: <>
Received: from localhost ( []) by (Postfix) with ESMTP id 3DDBE1A886D for <>; Mon, 30 Mar 2015 13:04:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -4.21
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 ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id b7fz3VAGHNiD for <>; Mon, 30 Mar 2015 13:04:31 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 551271A1B62 for <>; Mon, 30 Mar 2015 13:04:31 -0700 (PDT)
Received: from (unknown []) by Websense Email Security Gateway with ESMTPS id 38166AE10EDD4; Mon, 30 Mar 2015 20:04:25 +0000 (GMT)
Received: from ( []) by (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 [] ( []) by (8.13.8/TPES) with ESMTP id t2UK4OTE024083; Mon, 30 Mar 2015 15:04:25 -0500 (CDT)
User-Agent: Microsoft-MacOutlook/
Date: Mon, 30 Mar 2015 16:04:32 -0400
From: Wendy Roome <>
To: Phillip Hallam-Baker <>, JSON WG <>
Message-ID: <>
Thread-Topic: [Json] Doofus Parameter Labels
References: <>
In-Reply-To: <>
Mime-version: 1.0
Content-type: text/plain; charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable
Archived-At: <>
Subject: Re: [Json] Doofus Parameter Labels
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-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

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" <> 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
>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