Re: [Json] "best practices" Vs. Profile for i-json

Nico Williams <nico@cryptonector.com> Mon, 04 August 2014 16:55 UTC

Return-Path: <nico@cryptonector.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 501B01A0029 for <json@ietfa.amsl.com>; Mon, 4 Aug 2014 09:55:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.666
X-Spam-Level:
X-Spam-Status: No, score=-1.666 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, IP_NOT_FRIENDLY=0.334, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=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 L7N0kR4AiN9e for <json@ietfa.amsl.com>; Mon, 4 Aug 2014 09:55:08 -0700 (PDT)
Received: from homiemail-a66.g.dreamhost.com (sub4.mail.dreamhost.com [69.163.253.135]) by ietfa.amsl.com (Postfix) with ESMTP id 6CB291A0023 for <json@ietf.org>; Mon, 4 Aug 2014 09:55:08 -0700 (PDT)
Received: from homiemail-a66.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a66.g.dreamhost.com (Postfix) with ESMTP id 4798B350082; Mon, 4 Aug 2014 09:55:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=cryptonector.com; bh=XHkad9kblJg+UE JhPe8lWfdkaJA=; b=rAdTKXRKDlg5ypZ/SywMdzQcDsG83DfmRbyj5qvpYoBGgU g77VNxH6qC1Y1Cq0Eyq6w6XvOEDjkcabxZZDMvDRFGT6vbdrOGWuPtMPLGn5S/iO GTO8kQLi6kOOaZF6hWCdRAjXiwuhCQXkMm8i2mdTG6bGr7Y8zczrKGl0+AwW4=
Received: from localhost (108-207-244-174.lightspeed.austtx.sbcglobal.net [108.207.244.174]) (Authenticated sender: nico@cryptonector.com) by homiemail-a66.g.dreamhost.com (Postfix) with ESMTPA id E48CF350072; Mon, 4 Aug 2014 09:55:07 -0700 (PDT)
Date: Mon, 04 Aug 2014 11:55:07 -0500
From: Nico Williams <nico@cryptonector.com>
To: Stephen Dolan <stephen.dolan@cl.cam.ac.uk>
Message-ID: <20140804165506.GL3579@localhost>
References: <2d53157574f749e0b1399b9e39564ecd@BL2PR02MB307.namprd02.prod.outlook.com> <CA+mHimPoZzmoio0Y+JgUDHd4b9B4yPm9fc3a1SCV6tayJ_9z7A@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CA+mHimPoZzmoio0Y+JgUDHd4b9B4yPm9fc3a1SCV6tayJ_9z7A@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Archived-At: http://mailarchive.ietf.org/arch/msg/json/tyYWkZY06Dhy08KWZ1tn5QohKQo
Cc: IETF JSON WG <json@ietf.org>, Larry Masinter <masinter@adobe.com>
Subject: Re: [Json] "best practices" Vs. Profile for i-json
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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: Mon, 04 Aug 2014 16:55:09 -0000

On Mon, Aug 04, 2014 at 01:29:03PM +0100, Stephen Dolan wrote:
> Two JSON documents differing only in whitespace outside strings are
> (MUST be? SHOULD be?) considered equivalent by any implementation. If
> you want to specify "use doubles" you should state something similar,
> like:
> 
> "An implementation [MUST NOT/SHOULD NOT] distinguish between two
> numeric literals whose decimal values round to the same IEEE754
> double-precision value (using standard round-to-nearest, ties-to-even
> rounding)."

Is a MUST really needed?  Suppose you have an encoder that produces
numbers (not irrationals) that require better-than-IEEE754 to represent
exactly.  A parser that can only handle IEEE754 should accept such
numbers, but with loss of precision/range -- exactly what we already
knew to expect from JSON as far as interoperability goes.

My concern is that a MUST NOT -even a SHOULD NOT- is too strong and will
either a) cause implementations with better-than-IEE754 numbers to lose
date at encode time even when the next parser in the chain also has
better-than-IEE754 numbers, or b) this will discourage
better-than-IEE754 implementations.  We might end up stuck with IEEE754
for a long, long time.

It should suffice to have a requirement that parsers support at least
IEEE754 (e.g., not 32-bit integers) and a warning that sending numbers
that cannot be represented with IEEE754 may lead to data loss.

Nico
--