Re: [Json] Update Standard to support ECMA-262 BigInt

Rob Sayre <sayrer@gmail.com> Fri, 30 April 2021 19:58 UTC

Return-Path: <sayrer@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 B5D8E3A24F6 for <json@ietfa.amsl.com>; Fri, 30 Apr 2021 12:58:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
X-Spam-Status: No, score=-2.097 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 5c88TFmu4M4q for <json@ietfa.amsl.com>; Fri, 30 Apr 2021 12:58:52 -0700 (PDT)
Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 C9F753A24F5 for <json@ietf.org>; Fri, 30 Apr 2021 12:58:51 -0700 (PDT)
Received: by mail-ej1-x631.google.com with SMTP id gx5so14896438ejb.11 for <json@ietf.org>; Fri, 30 Apr 2021 12:58:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SmqZvE+Pa0Uko76zgCA6cMSiMtKBw2hOPNh/NPdUTcY=; b=IuzLuBvIWizDYAmKu2hTpMWMdtWojgmoySy+m2+bz3v/1zcyoq2VsKwhhTlXC8DR4L rY18euJ9Y+Unsmyv2eVjAVU+HRu0qWxm+pMxNdrprnVr8bdvMDCduiH7ryEhkXlWeI/M cGkWQtEN2XTIngcmfNCmE2jT9uzvQ6RdaaYdutOPzPFcEP2S0gWUPh0sRrOH3L2yI2WA xcX3l0guAqn/VgadfNl2/loYCJKSeydnBPYfR6qoNr88ZYZbKUVZwIX2q9CLPcnuPKZU qwHMUb4HdEG/FIcT/cwTVCfwOvlHT8/om08w7XRMLALWUPmVZngAnlB6yNlh+T+nIvB3 Z5OQ==
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=SmqZvE+Pa0Uko76zgCA6cMSiMtKBw2hOPNh/NPdUTcY=; b=CZgyvEwQlkt0yuF5XhEojwzALlmGACm70kDGSGsfNipqiHu+qiUQmt2G5yks4mYB4y /ySUXxau6ObFoLXcOd3ooBMv+DYdouZBz/Hq0++uMI9TyHEspO4Re1lqhUckjQbrntIr XunPLl2rUoDojBAuQMewdxuqr3PHgKu6UU7lpsOfbylzjWxylPRaLUn9E60M75DlSK8o wP8JDBR7sL/E2J+/oRUlJqMy48Izk76irjiSZ8VUzh0CpPfmqeQVFjsMIXIYNN3Mo+wx 5s0ykfq6ahL6IjdWRJrtMrbMPEIMrJmr65fPEEU9NQcq8xjRSX9ibuQHow9NwI04gloj rTHQ==
X-Gm-Message-State: AOAM530wh1lvJfyvV7FkIR/8HDy7hp5DonUXqS9LeQNeL/XGn7UrLoYW ZW46GbtX4puxbmkAeoxvMmWdJPirtgVQUMkb8ys=
X-Google-Smtp-Source: ABdhPJxUlHkhHM/+kFCxaqpNvlz6AVOZO+zd41CJRaqPJlHYWUv2UrFo2v1npzV+NKF5uqKcezMk4lB46AMyv0gx2gg=
X-Received: by 2002:a17:906:ca46:: with SMTP id jx6mr2039760ejb.434.1619812729276; Fri, 30 Apr 2021 12:58:49 -0700 (PDT)
MIME-Version: 1.0
References: <014e01d73aa1$81aa0d30$84fe2790$@thisisbeacon.com> <5987db79-06a7-69ab-faff-29c763a9a98d@codalogic.com> <CAE5tNmrrk8KjHh7-31Og0x-R+2S_4TQ-K4P+eJutO0p6K57FHg@mail.gmail.com> <CAHBU6ivd4nLuoZR-1NugkR2FEriSxH3D7Gg4zK+E6xceFu+xFg@mail.gmail.com>
In-Reply-To: <CAHBU6ivd4nLuoZR-1NugkR2FEriSxH3D7Gg4zK+E6xceFu+xFg@mail.gmail.com>
From: Rob Sayre <sayrer@gmail.com>
Date: Fri, 30 Apr 2021 12:58:38 -0700
Message-ID: <CAChr6Sz17YRmNxkKMtfng+36O+dbuZqVqMsyvsr3vf2zYRTrWQ@mail.gmail.com>
To: Tim Bray <tbray@textuality.com>
Cc: David Kemp <dk190a@gmail.com>, JSON WG <json@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000054cb3f05c1360a90"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/msdlKfDjcXsX8pTLU-sMlEFq_Ng>
Subject: Re: [Json] Update Standard to support ECMA-262 BigInt
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: Fri, 30 Apr 2021 19:58:57 -0000

On Thu, Apr 29, 2021 at 4:38 PM Tim Bray <tbray@textuality.com> wrote:

> Yeah, speaking as the editor of a bunch of those RFCs, I would very much
> like it if JSON could be extended to have comments, timestamp literals, and
> typed numbers.
>

Well, if JSON had comments, it would have all sorts of extensions by now,
which is why it doesn't have them. Comments that are actually comments
would be nice, but programmers can't be trusted.


> But it's too late. JSON is finished, is generated and consumed by a very
> large amount of deployed software which is simply not going to be updated;
> changing the syntax at this point would be catastrophic.
>

Yes.


> For crypto apps, you pretty well have to put the big numbers in strings.
>

JSON numbers interchanged between languages that have arbitrary-precision
numbers work fine. But, JS BigInt (original post) operations aren't
constant time, so you shouldn't use them for crypto anyway [1].

Put the big numbers in strings if you think JavaScript might be in the
picture. For many other languages, you don't need to. It should also be
possible to detect number precision in a JSON encoder/decoder if really
desired.

thanks,
Rob

[1]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#cryptography
(see also the suggestion for JSON stringifying below)