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

Pete Cordell <petejson@codalogic.com> Tue, 04 May 2021 10:38 UTC

Return-Path: <petejson@codalogic.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 12A663A2EF6 for <json@ietfa.amsl.com>; Tue, 4 May 2021 03:38:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, NICE_REPLY_A=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=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 dpwMX7O8YATj for <json@ietfa.amsl.com>; Tue, 4 May 2021 03:38:03 -0700 (PDT)
Received: from ppsa-online.com (ppsa-online.com [217.199.162.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4F75D3A2EF9 for <json@ietf.org>; Tue, 4 May 2021 03:38:02 -0700 (PDT)
Received: (qmail 6183 invoked from network); 4 May 2021 11:38:00 +0100
Received: from host31-49-16-155.range31-49.btcentralplus.com (HELO ?192.168.1.72?) (31.49.16.155) by lvps217-199-162-217.vps.webfusion.co.uk with ESMTPS (TLS_AES_128_GCM_SHA256 encrypted, authenticated); 4 May 2021 10:38:00 -0000
From: Pete Cordell <petejson@codalogic.com>
To: Carsten Bormann <cabo@tzi.org>, Daniel P <danielaparker@gmail.com>
Cc: JSON WG <json@ietf.org>
References: <CA+mwktLWwDRYtF9BFSRnF4e7_v=e3F4HERS5yHptSksxGBysnQ@mail.gmail.com> <F1A006F9-8743-4930-B879-F83339A38485@tzi.org> <9e811395-2f56-f2b2-b4a6-c686544cb1ef@codalogic.com>
Message-ID: <a1eeecd9-3dc9-4f5f-8497-3141c9c91a89@codalogic.com>
Date: Tue, 04 May 2021 11:38:00 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0
MIME-Version: 1.0
In-Reply-To: <9e811395-2f56-f2b2-b4a6-c686544cb1ef@codalogic.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-GB
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/RMitSLQ2DI9EMm738yHg_c0BywE>
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: Tue, 04 May 2021 10:38:09 -0000

On 04/05/2021 11:11, Pete Cordell wrote:
> 2.
> Although possibly not formally released, we were considering a way of 
> declaring that a string had to adhere to an arbitrary format.  This was 
> a way of adding additional string based types (as there is no other 
> option in JSON for extended types!) without adding new base types (like 
> int32, date-http etc).  So, in a ruleset you could specify something like:
> 
>    #ruleset-id org.ietf.extended-types
> 
>    $rfc2822-date-time =
>          @{format org.ietf.extended-types.rfc2822.date-time} string
> 
> Then use it as:
> 
>    #import org.ietf.extended-types as iet
> 
>    {
>       "start-time" : $iet.rfc2822-date-time,
>       "end-time" : $iet.rfc2822-date-time
>    }
> 
> The spec for the "org.ietf.extended-types.rfc2822.date-time" format 
> might read something like:
> 
>    Formatted according to the RFC2822 date-time ABNF but omitting
>    the trailing [CFWS] term.
> 

Actually, @{format} doesn't have to be limited to strings.  You could 
also format other base types.  For example, @{format} on an int might 
look something like:

   #ruleset-id org.example.my-types

   $int-div-3 =
         @{format org.example.my-types.int-div-3} int

Where the definition for "org.example.my-types.int-div-3" is "positive 
integers that are multiples of 3".

Cheers,

Pete.
-- 
---------------------------------------------------------------------
Pete Cordell
Codalogic Ltd
C++ tools for C++ programmers, http://codalogic.com
Read & write XML in C++, http://www.xml2cpp.com
---------------------------------------------------------------------