Re: [Json] JSON Schema Language

Phillip Hallam-Baker <ietf@hallambaker.com> Tue, 07 May 2019 21:30 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 4448B120254 for <json@ietfa.amsl.com>; Tue, 7 May 2019 14:30:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.648
X-Spam-Level:
X-Spam-Status: No, score=-1.648 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
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 WwMQvM1zdyRR for <json@ietfa.amsl.com>; Tue, 7 May 2019 14:30:10 -0700 (PDT)
Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 A3B3B12029D for <json@ietf.org>; Tue, 7 May 2019 14:30:10 -0700 (PDT)
Received: by mail-ot1-f53.google.com with SMTP id w6so16425115otl.7 for <json@ietf.org>; Tue, 07 May 2019 14:30:10 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w7PhAUl6XCYqDHx0BD9pOUmwWV3cBBYHlloRSvowInc=; b=rUdCykctUOjI8d6eN3iKMxm1QtvttLZLYUpK/TaYWon9DdGzMNaWQAWZFmiSW7ITeZ 7xqQx8q3q4uCFrhzRUk59WkUxZpf3Km7e178+DpYMzEQPidlDtZNJaIxdebnM1qs8Y99 PC7qBwmvc+c7LQUILnN6rOucYP2DfrmXEzz0zQroLmmYWniu77EadFEAAEoSwYI1jJP6 7k6EpeEa8A72cuSJ6xFcUMymXuyvWUA2WfA9pjfRZgRXjfPjf9ciblRQc8oR6CIetQ3V lqQiOwLi78gHwZQji8GLVVYmoi3mlVAmogXVD57e56CPRNhZzYO3idFI8lAYscZ6qC7h K1FQ==
X-Gm-Message-State: APjAAAXNfBl69j3Goh+dCORkP49LhFhTW2Na7aDqhAuvwyPvlvO+hOJU d5BhpFFmhwGPYvFeRMt45J1UCMNabjAP5wFTslQ=
X-Google-Smtp-Source: APXvYqxRtyqo9D2jRgNvW9uvdf2j76kujdMa23Dp3FcynD7pXe40zRjpKSZnvrMFM0om2npytFfIhmB3/8fmVB5a2N0=
X-Received: by 2002:a9d:6d93:: with SMTP id x19mr12474174otp.157.1557264609933; Tue, 07 May 2019 14:30:09 -0700 (PDT)
MIME-Version: 1.0
References: <CAJK=1RjV1uv0eOdtFZ8cKn-FfCwCiGP5r2hOz1UamiM6YV4H1A@mail.gmail.com> <CAHBU6itE8kub1qtdRoW8BqxaOmzMv=vUo1aDeuAr3HX141NUGg@mail.gmail.com> <77994bdb-a400-be90-5893-b846a8e13899@gmail.com> <20190507154201.GP21049@localhost> <CEF72901-5077-4305-BA68-60624DCE952D@bzfx.net>
In-Reply-To: <CEF72901-5077-4305-BA68-60624DCE952D@bzfx.net>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
Date: Tue, 07 May 2019 17:29:59 -0400
Message-ID: <CAMm+Lwi4niziaJMuL2Zqe1eX-hQkv6J10xXMd2gxf5J4X8j8Cg@mail.gmail.com>
To: Austin Wright <aaa@bzfx.net>
Cc: Nico Williams <nico@cryptonector.com>, JSON WG <json@ietf.org>, Tim Bray <tbray@textuality.com>, Anders Rundgren <anders.rundgren.net@gmail.com>
Content-Type: multipart/alternative; boundary="000000000000e58403058852ebd8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/QvyzzhEvaf9SkgQ0NokoHOaJuuY>
Subject: Re: [Json] JSON Schema Language
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.29
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, 07 May 2019 21:30:12 -0000

On Tue, May 7, 2019 at 5:14 PM Austin Wright <aaa@bzfx.net> wrote:

>
> I would put it slightly differently: While JSON doesn’t define any concept
> of an “integer”, applications that encode integers (e.g. uint32_t or
> similar) might conceivably emit it with the "frac” production (using a
> trailing decimal and zero); this is not ambiguous, and in the interest of
> being liberal in what you accept, parsers shouldn’t produce any error.
>

The problem that arise are:

1) The lexical analyzer may distinguish integers and floats and this may
cause a schema driven parser to reject legitimate number because it is
encoded as a double. (e.g. 1.0)

2) There may be precision loss because the number is presented in
exponential form (1.0E20)

3) There may be precision loss because the integer is larger than the
floating point mantissa can hold.

We should probably stop talking about 'float' values because I don't know
of any JSON tech likely to use them at this point. Pretty much every
programming language out there today will cause all calculations to be
performed in Intel 80 bit floating point until the data has to be stored in
a program data value when the mantissa will be truncated at 52 bits and
stored in a double.

Fact is that a 64 bit processor can do 64 bit mantissa ops more easily than
52 bit. But we are stuck in the choices of the 1980s when memory was scarce
and nobody had 64 bit CPUs yet.