Re: [Json] 2-step proposal 4627bis + I-JSON

Tim Bray <tbray@textuality.com> Thu, 04 July 2013 04:25 UTC

Return-Path: <tbray@textuality.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 7136E11E80D1 for <json@ietfa.amsl.com>; Wed, 3 Jul 2013 21:25:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.993
X-Spam-Level:
X-Spam-Status: No, score=-1.993 tagged_above=-999 required=5 tests=[AWL=-0.983, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_LOW=-1, SARE_HTML_USL_OBFU=1.666]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gb3Ibl4cip17 for <json@ietfa.amsl.com>; Wed, 3 Jul 2013 21:25:11 -0700 (PDT)
Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by ietfa.amsl.com (Postfix) with ESMTP id 057DF11E8126 for <json@ietf.org>; Wed, 3 Jul 2013 21:25:04 -0700 (PDT)
Received: by mail-vc0-f181.google.com with SMTP id lf11so621798vcb.12 for <json@ietf.org>; Wed, 03 Jul 2013 21:25:04 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=+8kmVuL3FBnBYhxktIeeAuvIfGW++ZInzEX8Ar2mmGc=; b=awfI7huG6N93dyzHWykW+4WXHjUxrfkuVezesvloEW/+73iH7smcydx+kduE1cqDrZ 5nLmL4kXsLLX5V30BD2jMMFaCjbp41uOcVmaW/4L56o2sHSX+MHWiLocjIkd5CO0qwPe I6dxN5ANfRk/hUvUc9q7UrftDn8nGOQ2Q1yfrdEewiy7inIHJ6/NGtyy3MrnkT3NvRkL Hp3OitUoeWHb9cd01nyNSqbbN0VdGMcqqXU1748zcsom4QFOIys4+HJswT9LZDO30yDv aUyFraujGeGlJQ/7MRmsI0mBcMk5kSaJxRc21gO/h5xrvbykTgIVQjpqtNgNa97erZEV gcgg==
MIME-Version: 1.0
X-Received: by 10.52.177.6 with SMTP id cm6mr1382600vdc.0.1372911904385; Wed, 03 Jul 2013 21:25:04 -0700 (PDT)
Received: by 10.220.201.200 with HTTP; Wed, 3 Jul 2013 21:25:04 -0700 (PDT)
X-Originating-IP: [209.121.225.242]
In-Reply-To: <51D4F4F3.2070305@it.aoyama.ac.jp>
References: <CAHBU6itqGgndUKRUHH_q6fv8jonGL3VVHhkezFne0sC3T12c_Q@mail.gmail.com> <20130704002732.GV32044@mercury.ccil.org> <51D4F4F3.2070305@it.aoyama.ac.jp>
Date: Wed, 03 Jul 2013 21:25:04 -0700
Message-ID: <CAHBU6it0Qz7Yb5P1e9RA2F=CZ4yoY=TNqFq3a=atL2YHB+Q0RA@mail.gmail.com>
From: Tim Bray <tbray@textuality.com>
To: "Martin J. Dürst" <duerst@it.aoyama.ac.jp>
Content-Type: multipart/alternative; boundary="20cf3071cc1a5e7f0404e0a7f618"
X-Gm-Message-State: ALoCoQlSZww4PGJRYAbuCnMHoShx6DWq4l0XRf9QLaSVxsBIoZ5/aj6B/W2tHPKq5hEAvS+P76c8
Cc: John Cowan <cowan@mercury.ccil.org>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] 2-step proposal 4627bis + I-JSON
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
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: Thu, 04 Jul 2013 04:25:15 -0000

Languages like Ruby and Lisp are pretty well proof against almost any
imaginable numeric representation.

But programmers in statically typed languages are going to do the
equivalent of org.json.JSONObject.getLong() or getDouble(), and the idea in
I-JSON is that if something in a JSON body is a number, it should Just
Work.  So I’m beginning to like John’s idea.  Although it might be
plausible to also say that if the number has no fractional part, it MUST
fall in the 64-bit integer value range.

But anyhow, this is premature.  Let’s hear some input from our chairs & ID
as to what the WG should be trying to produce. -T


On Wed, Jul 3, 2013 at 9:07 PM, "Martin J. Dürst" <duerst@it.aoyama.ac.jp>wrote:

> On 2013/07/04 9:27, John Cowan wrote:
>
>> Tim Bray scripsit:
>>
>>  2. Recharter in a way that will allow us to produce something like a
>>> strawman I cooked up, I-JSON: https://www.tbray.org/tmp/i-**json.html<https://www.tbray.org/tmp/i-json.html>
>>> Produce something like that. Second victory!
>>>
>>
>> This is a fine trial balloon.  I have two comments:
>>
>
>  2) Stating the precision of numbers does not suffice: you ought also to
>> state explicitly that the valid range is numbers whose absolute value is
>> between 2^-1074 and (1 + (1 - 2^52)) * 2^1023, inclusive.  For example,
>> the integer 4503599627370497 is not exactly representable as a double (it
>> is 2^52+1) and ought not to be allowed in I-JSON.  So I still prefer my
>> proposal of "is exactly representable as an IEEE 754:2008 64-bit binary
>> floating point number".
>>
>
> That doesn't work very well either, because you might need quite a few
> digits after the decimal point to *exactly* represent a binary fraction in
> decimal numbers. As an example, try to write something like
> (2**52+1) / 2.0**200 (** being exponentiation)
>
> You'll need something like 50+ digits, but nobody does this. What e.g.
> Ruby does (since about version 2.0) is to produce a representation that has
> just as many digits as necessary to unambiguously have a single closest
> representation in IEEE 754:2008.
>
> Regards,   Martin.
>
> ______________________________**_________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/**listinfo/json<https://www.ietf.org/mailman/listinfo/json>
>