Re: [Json] Schemas & so on
Phillip Hallam-Baker <ietf@hallambaker.com> Tue, 03 May 2016 18:13 UTC
Return-Path: <hallam@gmail.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 87F2012D8C8 for <json@ietfa.amsl.com>; Tue, 3 May 2016 11:13:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.399
X-Spam-Level:
X-Spam-Status: No, score=-2.399 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.199, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 kW6_dMqrQuia for <json@ietfa.amsl.com>; Tue, 3 May 2016 11:13:42 -0700 (PDT)
Received: from mail-qg0-x22d.google.com (mail-qg0-x22d.google.com [IPv6:2607:f8b0:400d:c04::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4F95212D874 for <json@ietf.org>; Tue, 3 May 2016 11:12:08 -0700 (PDT)
Received: by mail-qg0-x22d.google.com with SMTP id 90so12131526qgz.1 for <json@ietf.org>; Tue, 03 May 2016 11:12:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=nNqD0V/rrMSGE839EuR5k3L496+PT0h8m8I18AHf3QQ=; b=uKqKRBgxLDr6F0nYu9GFBSL2fTwDvN/YBKnq/av7lDAL5kvTlnuNXgWva+Nks7KQwn 3+gJIeGrAlxI+TyikJAXys23evdr4u/2qfAX2HvMrWVSqcpskBjMzx5S8gAzq8cdZn+m VNxV9SOrKe1VacT0cj7O5sExRJIsDocMGXE3b+hDyc0dE72/YQfiqzI9Y99h/AZrhPbg YG6KPUm+PBI1zv2rgRoQREMMcBNFNPx9jqIVZgJgmj8HNej8gdzbLv6eBU9otUAZW8bc VKDPNjaqR8PPIeUJU3/9ovkTUl/HxM5J9VDWIxCdKqYVyD2Jjh0zudsOlK/CDJlE9JcY wJhg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=nNqD0V/rrMSGE839EuR5k3L496+PT0h8m8I18AHf3QQ=; b=UkjfsWzG2PAWBweOce150+ZeCGhqI3MWjdOTlQEc2QABpsFpHm0fwkznrFdRcp7cyd YxcGYYLvaGpPm1yATvAN/rCp1CgAZQ7G6vctls7FleD2GkTgB4XY454/UyKhZKuYIWoU Xy4+r3Z8sItQitNbeQTEF6DyNr4XyLvm0+go2CqAis05a6QNIPCmYq1wjJxkxzmo3Aw5 7XOC7TT3oDsYuSnZkFOTsjPSKSzEfZ3FH+imjmePjgy4BXA7FBwfBo/riEZ6UpbI55pl UqgsHkq92Y9OZAgaZWRpuDD+V+uMLq/ZEBCnUVuDxuK7tLkSLbyXDQC1Z1fWxia9m7jt 6gqA==
X-Gm-Message-State: AOPr4FV7yDYrQmWlQfODoJLou/fmzAqoICfLU3XcSHVlJ1c5ie03oKhaNkP5T7MIt76YuxpOs27Oo10b3d4rFQ==
MIME-Version: 1.0
X-Received: by 10.141.44.135 with SMTP id v129mr4379496qhe.46.1462299127471; Tue, 03 May 2016 11:12:07 -0700 (PDT)
Sender: hallam@gmail.com
Received: by 10.55.24.38 with HTTP; Tue, 3 May 2016 11:12:07 -0700 (PDT)
In-Reply-To: <20160503172537.GM29513@mercury.ccil.org>
References: <CAHBU6itCV9MXmALdKtE9-vjUPG6-6ZqdqzrmZkcEzSUysi3S-w@mail.gmail.com> <AC93811D-A16A-4527-B2EB-C6A9FC6D4F17@mnot.net> <20160503010109.GA17482@mercury.ccil.org> <CAMm+LwjVnh5H4REM9tUJjb7QvL2arxjkhjWybHerxbXUvkcMdA@mail.gmail.com> <20160503172537.GM29513@mercury.ccil.org>
Date: Tue, 03 May 2016 14:12:07 -0400
X-Google-Sender-Auth: JIejOhoBdjfzsyPlhohSt5U4Gpg
Message-ID: <CAMm+LwhMyFawLEQ-e04TA9hw8nsRbG0+1f3hEAhAYc0sgNqtjA@mail.gmail.com>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
To: John Cowan <cowan@mercury.ccil.org>
Content-Type: multipart/alternative; boundary="94eb2c0bdc240c668a0531f40c09"
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/cStFlNmVgQA7574iU4qic2z0DKo>
Cc: Mark Nottingham <mnot@mnot.net>, Tim Bray <tbray@textuality.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Schemas & so on
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
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: <https://mailarchive.ietf.org/arch/browse/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: Tue, 03 May 2016 18:13:44 -0000
On Tue, May 3, 2016 at 1:25 PM, John Cowan <cowan@mercury.ccil.org> wrote: > Phillip Hallam-Baker scripsit: > > > I don't see any need to specify upper or lower bounds on integers. We > don't > > do this in C, C# or any major programming language. > > > > We do specify bounds on representation, int32, uint32 etc. But that is > more > > a matter of convenience and space management. > > That seems to me to be a distinction without a difference. We need to > specify the bounds on specific JSON numbers so that we know that we can > safely deserialize them to language-specific types. I agree that we don't > need arbitrary bounds like -1..52 very much, but 0..255 is another matter. > It would probably be enough to allow a fixed set of bounds like u8, s8, ... > u64, s64, f32, f64. > Right now, my tool allows those hints to be specified when it is used to generate TLS schema serializers/deserializers but I haven't seen the need to use them for a JSON protocol so far. I think syntactic sugar does actually matter. That is I see a big difference between something like int MyField; and something like this {"MyField" : { "type" : "Integer", "max" : 42, "min" : -32 } } I think the chances of spotting a blooper in the second is a lot better. If I ever did another revision to my tools to put all of the parsers into one system, it would probably have an input language that was something like the following: MyStruct Class MyIntField Integer MyStringField String If I then wanted to specify representation it would probably be by subtyping 'Integer' to allow int8, uint8, ... int64, uint64 like you suggest. Right now, the only case where I see a need to call something out as a special case is for handling BigNums. We use those a lot in Crypto but it is a real pain to use a generator where every Integer is a bignum by default. It is also inefficient as you have to convert your bignum to decimal and back. The reason for having the 'label before declaration' rule is that it provides consistency. Every definition has the label first. C has a nasty habit of doing this differently for classes and fields/variables. Doing it the same way throughout is much cleaner. The label should go first because it is always one token while the definition may be a structure.
- [Json] Schemas & so on Tim Bray
- Re: [Json] Schemas & so on Martin J. Dürst
- Re: [Json] Schemas & so on Rob Sayre
- Re: [Json] Schemas & so on Erik Wilde
- Re: [Json] Schemas & so on Erik Wilde
- Re: [Json] Schemas & so on Tim Bray
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on Anders Rundgren
- Re: [Json] Schemas & so on Peter Cordell
- Re: [Json] Schemas & so on Joe Hildebrand (jhildebr)
- Re: [Json] Schemas & so on Austin William Wright
- Re: [Json] Schemas & so on Tim Bray
- Re: [Json] Schemas & so on Tim Bray
- Re: [Json] Schemas & so on Mark Nottingham
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Mark Nottingham
- Re: [Json] Schemas & so on Erik Wilde
- Re: [Json] Schemas & so on Anders Rundgren
- Re: [Json] Schemas & so on Rob Sayre
- Re: [Json] Schemas & so on Tim Bray
- Re: [Json] Schemas & so on Tim Bray
- Re: [Json] Schemas & so on Erik Wilde
- Re: [Json] Schemas & so on Tim Bray
- Re: [Json] Schemas & so on Cyrus Daboo
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Victor Kareh
- Re: [Json] Schemas & so on Peter Cordell
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Peter Cordell
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on Erik Wilde
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on Peter Cordell
- Re: [Json] Schemas & so on Joe Hildebrand (jhildebr)
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on Peter Cordell
- Re: [Json] Schemas & so on Joe Hildebrand (jhildebr)
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on - int54 Peter Cordell
- Re: [Json] Schemas & so on - int54 John Cowan
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on John Cowan
- Re: [Json] Schemas & so on Phillip Hallam-Baker
- Re: [Json] Schemas & so on Phillip Hallam-Baker