Re: [Json] Limitations on number size?

Jacob Davies <jacob@well.com> Wed, 10 July 2013 21:33 UTC

Return-Path: <cromis@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 2274121F9D80 for <json@ietfa.amsl.com>; Wed, 10 Jul 2013 14:33:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.978
X-Spam-Level:
X-Spam-Status: No, score=-1.978 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, NO_RELAYS=-0.001]
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 ySeKhRZFrO7A for <json@ietfa.amsl.com>; Wed, 10 Jul 2013 14:33:08 -0700 (PDT)
Received: from mail-qe0-x234.google.com (mail-qe0-x234.google.com [IPv6:2607:f8b0:400d:c02::234]) by ietfa.amsl.com (Postfix) with ESMTP id 9C05211E8123 for <json@ietf.org>; Wed, 10 Jul 2013 14:33:07 -0700 (PDT)
Received: by mail-qe0-f52.google.com with SMTP id i11so4017308qej.25 for <json@ietf.org>; Wed, 10 Jul 2013 14:33:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=5jO3ePxbljNRf+n8FUCUqVpN8/wo1OhHmBgoApnwmsg=; b=MW2M8hLHiPJimri9tgfKFXo/QwCt/sp/KLYjujwcdHNERCuhMRo2YmkaAa6bq3Y4Mb paIefy+XoXwjeATNILtv22kjlCfMtSRB3GXvVY6/YPl7GWYMzAyl8/DfSDA4jeD5GbYe ScvnKF84FFsBwy1k5MKG3lK32IEfLnPrQIipGlly2MbHRugTbbmW6HznLpOZd+kFHO4O jNFKbE1lKVplUymggFNm7Y/9P7IOAILW1CuDjnHqNsb+mRZkxNF+GUQimc3QFHT+nKpN gh7YBGBO8aJO8eiUUxWu/YZiph4wg0f1GUP5peehVi8HWXVmgjYojiYTlK64mkvrg3cx vvDQ==
X-Received: by 10.49.104.35 with SMTP id gb3mr27293703qeb.77.1373491986745; Wed, 10 Jul 2013 14:33:06 -0700 (PDT)
MIME-Version: 1.0
Sender: cromis@gmail.com
Received: by 10.49.76.42 with HTTP; Wed, 10 Jul 2013 14:32:42 -0700 (PDT)
In-Reply-To: <20130710024215.GO9153@mercury.ccil.org>
References: <51DC0F95.7010407@gmail.com> <hf8ot8hnpa93pi3t54c4d5qcc3p5tnb3ca@hive.bjoern.hoehrmann.de> <CAK3OfOgTNaLpRthrRcU4Bo+3z1aXUOOn0Ord7RBPN8z6TtiiWw@mail.gmail.com> <51DC7F87.6060503@gmail.com> <CAGrxA24v5L7oCGxEOwecJSLCNiLrSWSt=jFJMA0M9E8fztNLag@mail.gmail.com> <20130710024215.GO9153@mercury.ccil.org>
From: Jacob Davies <jacob@well.com>
Date: Wed, 10 Jul 2013 14:32:42 -0700
X-Google-Sender-Auth: ImQG6MebLhECd7lGPZ7oKKdUsDA
Message-ID: <CAO1wJ5RRk+GoJKUizp1Q92rRMNy62sYER-=6SUwjPh30DSuBwg@mail.gmail.com>
To: John Cowan <cowan@mercury.ccil.org>
Content-Type: text/plain; charset=ISO-8859-1
Cc: "Peter F. Patel-Schneider" <pfpschneider@gmail.com>, Nico Williams <nico@cryptonector.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, Tatu Saloranta <tsaloranta@gmail.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: Wed, 10 Jul 2013 21:33:09 -0000

On Tue, Jul 9, 2013 at 7:42 PM, John Cowan <cowan@mercury.ccil.org> wrote:
> Apparently, there are already practical problems with interchanging
> 64-bit longs: google for [json large numbers bugs] for lots of reports.

The canonical one was Twitter IDs, where they had to introduce a
(string) field in their JSON APIs called "id_str" which is not
guaranteed to be equal to the obsolete-but-included (number) field
"id".

> While there are apparently int32-only systems out there, it's clearly
> understood that they are unusually restricted: such is not the case
> for JavaScript-hosted implementations.

Yes, this is why I think the specification itself should note that for
interoperability with Javascript, the Javascript size limitations must
be respected, even if the specification does not require that in
itself. The number of JSON-to-Javascript implementations or uses must
surely outnumber all other uses of JSON by several orders of magnitude
so I'd argue that as far as "running code" goes the limitation on
practical, interoperable number size is quite real and surprising to
people trying to send data to Javascript from non-JS environments
where larger numbers are available. (I went so far in the Java
libraries I wrote as to encode/decode longs & Big* as strings.)