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

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

Return-Path: <petejson@codalogic.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 47A643A10C3 for <cbor@ietfa.amsl.com>; Tue, 4 May 2021 09:56:40 -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 PEzxCmsgUIWu for <cbor@ietfa.amsl.com>; Tue, 4 May 2021 09:56:35 -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 014BF3A125C for <cbor@ietf.org>; Tue, 4 May 2021 09:56:34 -0700 (PDT)
Received: (qmail 7005 invoked from network); 4 May 2021 17:56:26 +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 16:56:26 -0000
To: Carsten Bormann <cabo@tzi.org>
Cc: cbor@ietf.org, JSON WG <json@ietf.org>, Daniel P <danielaparker@gmail.com>
References: <CA+mwktLWwDRYtF9BFSRnF4e7_v=e3F4HERS5yHptSksxGBysnQ@mail.gmail.com> <F1A006F9-8743-4930-B879-F83339A38485@tzi.org> <9e811395-2f56-f2b2-b4a6-c686544cb1ef@codalogic.com> <DC77FE0A-E0E1-4A92-AD7D-4522E450BED4@tzi.org> <9771fc21-0193-1338-a128-fb9bdf00db66@codalogic.com> <881D79CF-3CA2-46B4-8D9C-CC0D3D817403@tzi.org>
From: Pete Cordell <petejson@codalogic.com>
Message-ID: <f1e29330-f71a-ee0c-5b9e-77b262d46905@codalogic.com>
Date: Tue, 4 May 2021 17:56:25 +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: <881D79CF-3CA2-46B4-8D9C-CC0D3D817403@tzi.org>
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/cbor/PPl5YbtUurb7ZNoanxRSqBqqnCI>
Subject: Re: [Cbor] [Json] Update Standard to support ECMA-262 BigInt
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 04 May 2021 16:56:40 -0000

On 04/05/2021 14:38, Carsten Bormann wrote:
> On 2021-05-04, at 15:05, Pete Cordell <petejson@codalogic.com> wrote:
>>
>> The example wasn't intended to be about ABNF, but saying specifying formats in purely machine readable ways usually ends up being insufficient.  Having provision for human understood formats done in such a way that a machine can ask 'does this value conform to this format that you, smart human, have coded?' allows a simple way to side-step that problem.
>>
>> So in addition to the ABNF (or any other equivalent you might choose) you can also include to narratively define the constraints on say, date-mday etc.
> 
> Sure, we can add something like that, that is an interesting thought.
> 
> I’m mostly in favor of also providing a machine-executable form, which may not cover all the bases (if I say there is a “signature” of type “bstr”, I won’t be able to specify in CDDL what exactly I want from that :-).

I agree that an ABNF option is good.  In fact, if I had to choose 
between ABNF and regex, I'd go with ABNF.

But your example did make me think, did you consider HEREDOC format in 
CDDL? e.g. something like:

    rfc3339 = <<ABNFEND
       date-fullyear   = 4DIGIT
       date-month      = 2DIGIT  ; 01-12
       date-mday       = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on
                                 ; month/year
       time-hour       = 2DIGIT  ; 00-23
       time-minute     = 2DIGIT  ; 00-59
       time-second     = 2DIGIT  ; 00-58, 00-59, 00-60 based on leap sec
                                 ; rules
       time-secfrac    = "." 1*DIGIT
       time-numoffset  = ("+" / "-") time-hour ":" time-minute
       time-offset     = "Z" / time-numoffset

       partial-time    = time-hour ":" time-minute ":" time-second
                         [time-secfrac]
       full-date       = date-fullyear "-" date-month "-" date-mday
       full-time       = partial-time time-offset

       date-time       = full-date "T" full-time
    ABNFEND .cat rfc5234-core

    rfc5234-core = <<ABNFEND
       DIGIT          =  %x30-39 ; 0-9
       ; abbreviated here
    ABNFEND

(I think HEREDOCs would normally end when only the end token appears on 
its own line, but CDDL could say it has to be the first token on the 
line ad other tokens could follow so you can get your .cat rfc5234-core in.)

And I forgot earlier to say thanks for the links to WGs using CDDL for 
JSON.  So thanks for that.  I'll have a look at them.

Looking forward to the the ability to combine multiple CDDL files 
together being in place.

Cheers,

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