Re: [Json] JSON Schema Language

John Cowan <cowan@ccil.org> Sun, 05 May 2019 17:05 UTC

Return-Path: <cowan@ccil.org>
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 6D115120159 for <json@ietfa.amsl.com>; Sun, 5 May 2019 10:05:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=ccil-org.20150623.gappssmtp.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 P1x1f69L60m9 for <json@ietfa.amsl.com>; Sun, 5 May 2019 10:05:44 -0700 (PDT)
Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (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 DC1F1120148 for <json@ietf.org>; Sun, 5 May 2019 10:05:43 -0700 (PDT)
Received: by mail-wr1-x443.google.com with SMTP id l2so14231756wrb.9 for <json@ietf.org>; Sun, 05 May 2019 10:05:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccil-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Zh6qpcr44WkRwBzd3/UMsdfqH7YSAKFwvT0sFGP1iAs=; b=fukOuxKKLBcOMtInHeN2na0J+diUgsNHkSmx3osNVC2nopxuAHgJmDsbEYZYR5AGEu TZCOemIG7OadE41Bk1N/1dWGmOz6Wyc7lq5k7xLOud/q9OiIchOWAnk/TjzXTXcwCGOF 7eYzjLcWsEb20PYeXLz5GNJsapIoHbnNbOWBUYbpZnmzL68wY/uCSrngzlVN5uZn5AV1 C8W7KjT39K9UEZC8Z/7WJ+e7cHSqMdlQgwm4PiIjjAS6nYbjm+bkIqsXOCAj2QDHZxTT zhBn+85glLPCRP3uK9PUaojx/k7fNQ1XpxhTpEQMVr6j8HOzGLk9TqKMWPICpFoOAfE0 7J+Q==
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=Zh6qpcr44WkRwBzd3/UMsdfqH7YSAKFwvT0sFGP1iAs=; b=gLI0zTue2Zp3ueoeMnO2VYg4WTBKj5yJGQCpkROH35bISaqDHTMsOxuvF0ZVYyc6Dt 76DsO/70NwbRXXf9fK8MM2WbBjv5wNF31r18HF8y7pU9wTK3/PTQFQwiGADAjKNc/UTC pyJU8ID+addnGomzZgQdZRXYevi/7l6vQFgo/oV7Y4q1io98avdftLWOgaylqNnfwmMg RMCAjrIUuENNzdGvzKuns0uw++cSh4LBycE+bnlUjevEQmsQC9yf5z5lOZuMhLwLUVrI 6jf54CjxsT/nRcYMtLZCvJftt/NFFwGwpZM7QUSlc/iBZbCJcw1xN/uLLhBOhMxRY9cL ABgg==
X-Gm-Message-State: APjAAAXFI+PXXFSHrPAWEQNgVqaHXc7uBkH04sUfUPP2PhaH5HadYXzr sEtsUN7TExpXLWyoRtj0E4i6LTPr9nMwsKQdCS4FjQ==
X-Google-Smtp-Source: APXvYqz2SrKdAX8ol88e/XuRHigoNrlMi0s8XXVjjx5MqHDgF/cdw0glrC6bUGOpWzZs67Ck9Txk1TF6JuPTiS61vFE=
X-Received: by 2002:a05:6000:c2:: with SMTP id q2mr4289834wrx.324.1557075942304; Sun, 05 May 2019 10:05:42 -0700 (PDT)
MIME-Version: 1.0
References: <CAJK=1RjV1uv0eOdtFZ8cKn-FfCwCiGP5r2hOz1UamiM6YV4H1A@mail.gmail.com> <39682ec8-f993-a44c-d3e2-1638d2c1608f@gmail.com> <20190505053921.GA21049@localhost> <ac285e33-0ddc-3b96-fb50-de9b65f40c0e@gmail.com> <20190505070023.GB21049@localhost> <56070772-de6f-2553-94c0-df75c08b4c80@gmail.com> <20190505163626.GC21049@localhost>
In-Reply-To: <20190505163626.GC21049@localhost>
From: John Cowan <cowan@ccil.org>
Date: Sun, 05 May 2019 13:05:30 -0400
Message-ID: <CAD2gp_TZYYBTnfd3v6mW2DxjEZxA9nZ-tve_18Gi86gTx8ZcxQ@mail.gmail.com>
To: Nico Williams <nico@cryptonector.com>
Cc: Anders Rundgren <anders.rundgren.net@gmail.com>, json@ietf.org, Ulysse Carion <ulysse@segment.com>
Content-Type: multipart/alternative; boundary="0000000000006e04c6058826fe12"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/5inMccuZ5qXxXt1bBmFRF2stLo0>
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: Sun, 05 May 2019 17:05:46 -0000

The Scheme language makes very clear distinctions here.  Integers are a
subset of rational numbers, which are a subset of real numbers, which are a
subset of complex numbers, and there are predicates for detecting any of
them (normally `complex?` is the same as `number?`, but if you want to add
quaternions you can).

Orthogonal to this, there are exact and inexact numbers: a numeric literal
can be explicitly marked as either one, but the default is that a number
with a decimal point or exponent is inexact, and without either it is
exact.  Mixed exactness operations produce inexact results unless the
implementation can prove that the inexactness can't matter: the product of
5.0 (inexact) and 0 (exact) can be either exact or inexact.

On Sun, May 5, 2019 at 12:36 PM Nico Williams <nico@cryptonector.com> wrote:

> On Sun, May 05, 2019 at 09:12:05AM +0200, Anders Rundgren wrote:
> > On 2019-05-05 09:00, Nico Williams wrote:
> > > On Sun, May 05, 2019 at 07:52:18AM +0200, Anders Rundgren wrote:
> > > > On 2019-05-05 07:39, Nico Williams wrote:
> > > > > On Sat, May 04, 2019 at 06:47:35AM +0200, Anders Rundgren wrote:
> > > > > > Example: although 10.0 is a valid JSON Number, in system where
> you expect
> > > > > > an integer, this should be flagged as a syntax error.
> > > > >
> > > > > As a maintainer of one popular implementation, this idea that
> having a
> > > > > zero fractional part makes a number non-integer annoys me a great
> deal.
> > > >
> > > > As I described, this is incompatible with other popular
> > > > implementations like Jackson for C#.
> > >
> > > That sounds like a bug in Jackson.
> >
> > It also flags numbers that doesn't fit into the declared type.
>
> That's a different story.
>
> An application may not have control over what its encoder does here, but
> it will have control over the semantic values.  So if a value is
> expected to be an integer between 0 and 9, inclusive, then 10.0 is not
> valid.  But 9.0 must be because there can be and almost certainly are
> encoders that will output integers with a zero fractional part.
>
> Nico
> --
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>