Re: [Json] Schemas & so on

Phillip Hallam-Baker <ietf@hallambaker.com> Wed, 04 May 2016 14:02 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 6D0D712D1EC for <json@ietfa.amsl.com>; Wed, 4 May 2016 07:02:45 -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 lg6qGbJcec0k for <json@ietfa.amsl.com>; Wed, 4 May 2016 07:02:42 -0700 (PDT)
Received: from mail-qg0-x231.google.com (mail-qg0-x231.google.com [IPv6:2607:f8b0:400d:c04::231]) (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 8C7C812D1EB for <json@ietf.org>; Wed, 4 May 2016 07:02:42 -0700 (PDT)
Received: by mail-qg0-x231.google.com with SMTP id f74so23510206qge.2 for <json@ietf.org>; Wed, 04 May 2016 07:02:42 -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=6uqMB1fFDFr4Mz0dnb9KZK/DOWD7M3tbdxf32u7lecY=; b=xrEHH8X+DheiNYmaqW+QsLFSty8t6081Msv1btHbAV5XSEB84IttSVbc7vsolREWvl qXzvjQdlra7WulQoAdPuJ+zCbNNQvFOjeRNG8Q4JZXes7fdpL9rQFpfH98Q+2UMgyp89 /KN9DlhqJ3F7bG+qQfpu3pggZllxTS5nLCfWBaWIfBtgGhvHAJyNWmrtffC6txh/p4Vi HImHtXLNBko4ta9AGBbdYEBzQ/AqTLofoVS+/94x2wYQ9Liifz+g5H/tfm9mPMhpvFrV BYyV4mS1HZ7LvXLIJmktJjrcmUAlJsmKTG8TVfCh7w9Q9JHQdbzEPe1aopd006xVZQIZ h70w==
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=6uqMB1fFDFr4Mz0dnb9KZK/DOWD7M3tbdxf32u7lecY=; b=GjPL76XitSPh47d7/CBHoFrOrojNvmQQQ4HV7PraPkxa/wJGrXi6K6ITnGoAUVai5f hGARNu52rmGojsj8hT1BW5kXma1aLgUnWmH2cR2k9JYpZIWRYtYaWszurzh/ZNbuk84P hBi1Vhg1XSmFvg/NwYyY387JqUqj0i0ETAoFg6UEAYhW8Miv9o80uBJlfb+Ya2rkHzcr h/5OEkBxgelKtkpwGrvtLe/kyvm5WnFfJaLu/yQKSncHua7/kkHjlW2Lv1PY/+TfcR8O eSVydEhmqxNZ+yd8AGpft7CklAFSrOvzrFGcI7SykE/P3XhMnNVsTxxtXwRy/XC0sXda gs0w==
X-Gm-Message-State: AOPr4FVqtxQXXBrtOR4GDo2xZDqizPe/uNoHIrT0gE6EI0rkLBdjDKxg+9Vr+8BE6VUOCzFV7L50kabjiibmfQ==
MIME-Version: 1.0
X-Received: by 10.141.44.135 with SMTP id v129mr8927965qhe.46.1462370561706; Wed, 04 May 2016 07:02:41 -0700 (PDT)
Sender: hallam@gmail.com
Received: by 10.55.24.38 with HTTP; Wed, 4 May 2016 07:02:41 -0700 (PDT)
In-Reply-To: <20160503214528.GF6756@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> <CAMm+LwhMyFawLEQ-e04TA9hw8nsRbG0+1f3hEAhAYc0sgNqtjA@mail.gmail.com> <b60b59d0-ec4e-fba9-fe81-13b0d924ae50@codalogic.com> <D134B11A-34D6-48C3-87EE-5BFAFDCEE757@cisco.com> <CAMm+LwjtwwVErnB3MDW_n4ONt-h5XYKg2SGGrOOqw7XwKr6zmQ@mail.gmail.com> <46FCFC42-3FF1-4CD5-A397-A0553B43AC39@cisco.com> <20160503214528.GF6756@mercury.ccil.org>
Date: Wed, 04 May 2016 10:02:41 -0400
X-Google-Sender-Auth: D-nys0SmhF5rzc7mR9J2n8I1UxY
Message-ID: <CAMm+Lwgjvidj5=Hx1XyNZk0sEZuHBxxTVW0Vc2bBBOYR_VO6cw@mail.gmail.com>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
To: John Cowan <cowan@mercury.ccil.org>
Content-Type: multipart/alternative; boundary="94eb2c0bdc24dc5231053204adf8"
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/F6SEMz7G5fNWS9FTBwkY2Itncro>
Cc: Tim Bray <tbray@textuality.com>, Peter Cordell <petejson@codalogic.com>, "Joe Hildebrand (jhildebr)" <jhildebr@cisco.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: Wed, 04 May 2016 14:02:45 -0000

On Tue, May 3, 2016 at 5:45 PM, John Cowan <cowan@mercury.ccil.org> wrote:

> Joe Hildebrand (jhildebr) scripsit:
>
> > You need to test integers larger than 2^53 with the JSON implementation
> > in ECMAscript then.  RFC 7159, section 6 says
>
> Indeed, and browsers are surely not the only JSON implementations to
> treat all numbers as IEEE 64-bit binary floats.
>
> If we are going to have a type for integers representable as floats,
> then it should be called int54 according to the usual conventions,
> with the caveat that -(2**53) cannot be represented, because floats
> are not two's-complement.
>

I agree. I use -MaxInt as a Not a Number value in my code anyway...

Right now however, JSON isn't really suited to use as a data exchange
format for scientific use. Which is one of the things I tried to address in
JSON-B (Binary) and JSON-D (Data).

The JSON has unallocated code points that can be used to useful extend the
serialization to add additional encodings. For length delimited strings,
binary data etc. CBOR introduced a completely different data model with the
result that the JOSE working group had to be followed by a CBOR specific
one.

Binary encoding of floats is the simplest and most reliable method of
ensuring that they round trip. And that is essential if an encoding is
going to be viable for data exchange. JSON-B has binary encodings for the
IEEE 32 and 64 bit floats for that reason and JSON-D adds in the higher
precision Intel formats that use the whole 64 bits for the mantissa.

That said, binary encoding means losing the 'text file' property of JSON.
If I was going to use JSON for scientific purposes, I might well add in a
base16 or base64 encoding for floats.


Using the unused code points for extension has the advantage that even
though each serialization option requires a different encoder, a single
decoder can recognize all four variations (JSON, JSON-B, JSON-C, JSON-D).
That simplifies protocol implementation as it is only necessary for a
service to say what it will accept, it is not necessary for a client to tag
what it actually sends. It also allows encapsulation to work as you would
expect.