Re: [Json] Limitations on number size?

Tim Bray <tbray@textuality.com> Thu, 11 July 2013 22:56 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 BCBB011E8136 for <json@ietfa.amsl.com>; Thu, 11 Jul 2013 15:56:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.476
X-Spam-Level:
X-Spam-Status: No, score=-6.476 tagged_above=-999 required=5 tests=[AWL=-3.500, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1]
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 uWtvL7JCGZg0 for <json@ietfa.amsl.com>; Thu, 11 Jul 2013 15:56:31 -0700 (PDT)
Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by ietfa.amsl.com (Postfix) with ESMTP id 3CBC121F9BEB for <json@ietf.org>; Thu, 11 Jul 2013 15:56:30 -0700 (PDT)
Received: by mail-vc0-f171.google.com with SMTP id gd11so7278149vcb.16 for <json@ietf.org>; Thu, 11 Jul 2013 15:56:30 -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=XU79WwiOt3+vXQuYXq97Lk9n40NuvZRUfKEtxMQkTnE=; b=Gvccwadc/Q0hdj+U0GBGuOzalr2VN/cPSZifkZcTrUCHMjqL5pqhtz3dOiP2cb98sn KUE2pIKdBy2HigNpqiDN0Ok4qag3fuj9NDvCuJxTqsVnw5UQKM7yakMKqOitZklqu4ic LlqGE1UDN3pi/zBLxu1zMItWFmrAWG9PR7rAmXViJ7ki4xTutdKpRccdvb1u+cJGNjpK zGZkZTapkc8t0/h4FpS/JZX69R6BVg0Sl8BxXzjU+MbaIOvIYX7QEORaN9zx0i/LqLD8 n+kKxAGUY1rAyzL0uSq6gYMq+NzcwF/W1oI7FfX0XLYUkmj8xdBnIrzUETCNCu+7KP2L AmZw==
MIME-Version: 1.0
X-Received: by 10.58.54.70 with SMTP id h6mr22959606vep.36.1373583390358; Thu, 11 Jul 2013 15:56:30 -0700 (PDT)
Received: by 10.220.219.200 with HTTP; Thu, 11 Jul 2013 15:56:30 -0700 (PDT)
X-Originating-IP: [96.49.81.176]
In-Reply-To: <CALcybBCz_rw=NCjJ3ykYHkmwYzhH0mXbbMNBG=_DwOLM4dUgAw@mail.gmail.com>
References: <51DC0F95.7010407@gmail.com> <hf8ot8hnpa93pi3t54c4d5qcc3p5tnb3ca@hive.bjoern.hoehrmann.de> <CAK3OfOgTNaLpRthrRcU4Bo+3z1aXUOOn0Ord7RBPN8z6TtiiWw@mail.gmail.com> <51DC7F87.6060503@gmail.com> <D3773B95-FF52-45D7-BE9F-2DEC92AFA67E@jorgechamorro.com> <51DC92B1.7000908@gmail.com> <CALcybBBF+=7RE3wqhZE6m=VzQ1HZK3GChoZd2xr_3x992521pg@mail.gmail.com> <CAK3OfOiQdHcGGMW2=aYiLvgYWmd_X6T+7mtqnV0m101XEz=pgQ@mail.gmail.com> <CALcybBCpeZZY+WTWuHb_=ArG_FZhJZ-fNLvSs42_JWy8+919-g@mail.gmail.com> <CAK3OfOh7YNbfCKe9Y1Q_5GA2NeK2+a-MajpxBg=pDE8oF3w+6Q@mail.gmail.com> <CALcybBCz_rw=NCjJ3ykYHkmwYzhH0mXbbMNBG=_DwOLM4dUgAw@mail.gmail.com>
Date: Thu, 11 Jul 2013 15:56:30 -0700
Message-ID: <CAHBU6it_TTqKkRxv0YUMTTzMD0rXELtttX5_zDc6dAgb7m3+QA@mail.gmail.com>
From: Tim Bray <tbray@textuality.com>
To: Francis Galiegue <fgaliegue@gmail.com>
Content-Type: multipart/alternative; boundary="089e0122ad060d4f2c04e1444e50"
X-Gm-Message-State: ALoCoQn8QUyQqo6XLyvXkergad0XsYnVXxgB24UD7ytdGOKhlRC2Tnk/QbBcXtakUtg69rQH4+Uo
Cc: Nico Williams <nico@cryptonector.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, "Peter F. Patel-Schneider" <pfpschneider@gmail.com>, Jorge Chamorro <jorge@jorgechamorro.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Limitations on number size?
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, 11 Jul 2013 22:56:35 -0000

On Thu, Jul 11, 2013 at 3:41 PM, Francis Galiegue <fgaliegue@gmail.com>wrote:

> I agree, but then it is up to the protocols to define that. Say you
> want to exchange prices over JSON, then it makes sense to require that
> numbers be limited to two digits after the decimal point and, why not,
> require that scientific notation not be used. (and 0.01 cannot be
> represented reliably with a 64bit IEEE 754 floating point number, too)
>

Well yeah, but most programmers want to use generic non-app-sensitive
libraries to deserialize JSON into structs or objects or database records
or whatever, and if you send a 78-digit number that will usually break.  So
as long as you have pre-agreement and a flexible enough library, you’re
probably good.  This is the main reason I thought I-JSON was worth
defining, to maximize the chance that you can use a nice simple library at
both ends and have the lowest possible chance of breakage. -T


>
> But I believe this is not the role of JSON proper to define that.
>
> > [...] If we specify no semantics then we're stuck with either the
> > maximal interpretation of the grammar (binary strings! bignums! allow
> > dup names! [since no specific handling of dup names can be considered
> > a maximal interpretation...]) or an agreed subset, de facto or de
> > jure.
> >
>
> I don't believe duplicate object names are quite the same level. This
> was rather an oversight of RFC 4627 imho.
>
> --
> Francis Galiegue, fgaliegue@gmail.com
> JSON Schema in Java: http://json-schema-validator.herokuapp.com
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>