Re: [Cbor] Reviewing cbor-cddl-control

Carsten Bormann <cabo@tzi.org> Mon, 26 July 2021 14:57 UTC

Return-Path: <cabo@tzi.org>
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 8504A3A1838; Mon, 26 Jul 2021 07:57:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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 HaA_s4YcWSpe; Mon, 26 Jul 2021 07:57:11 -0700 (PDT)
Received: from gabriel-smtp.zfn.uni-bremen.de (smtp.uni-bremen.de [134.102.50.15]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1A8643A1833; Mon, 26 Jul 2021 07:57:11 -0700 (PDT)
Received: from [192.168.217.118] (p548dcc89.dip0.t-ipconnect.de [84.141.204.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4GYNLY2758z2xJt; Mon, 26 Jul 2021 16:57:09 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <YP7JCZPXLwuIK+Gi@hephaistos.amsuess.com>
Date: Mon, 26 Jul 2021 16:57:08 +0200
Cc: draft-ietf-cbor-cddl-control@ietf.org, cbor@ietf.org
X-Mao-Original-Outgoing-Id: 649004228.903319-bbcd7deeec299c5adc7d3b3e421d35a6
Content-Transfer-Encoding: quoted-printable
Message-Id: <F1AFBCD1-F8CD-4180-A51E-5E3C130E3D27@tzi.org>
References: <YP7JCZPXLwuIK+Gi@hephaistos.amsuess.com>
To: Christian Amsüss <christian@amsuess.com>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/mc48EeK6DS1SnvRAdnzOxP_uw-8>
Subject: Re: [Cbor] Reviewing cbor-cddl-control
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: Mon, 26 Jul 2021 14:57:17 -0000

Hi Christian,

> On 2021-07-26, at 16:39, Christian Amsüss <christian@amsuess.com> wrote:
> 
> Hello Carsten,
> 
> as part of my shepherd writeup I'm also doing a full review of
> cbor-cddl-control, in the version d85f6530 from the wglc branch that
> already addresses Henk's comments.
> 
> I find this document well rounded and readable, with most items more
> curious pokings at the mechanisms than necessary changes.
> 
> * Two editorial items are better handled as a PR:
>  https://github.com/cbor-wg/cddl-control/pull/8

Approved PR, would like one more pair of eyes before merging.

> * Numeric addition: While well-defined as written, implicit mixing of
>  integers and floats feels a bit inconsistent with CDDL's take on
>  ranges (which is more type strict in that respect in its section
>  2.2.2.1). Is there a particular reason to implicitly cast here?

Only that there is no other way to do it (the same as with strings below).

> * In Section 2.2 String Concatenation, it is pointed out that the sides
>  are not necessarily unique. The mental example forming here for me is
> 
>      ((bstr .abnfb "reg-name") .cat ': ') .cat (bstr .regexp some-expression)
> 
>  that make the "not all tools may be able to work with" easy to
>  understand.
> 
>  Conceptualy, the same would apply to numeric addition; for example,
>  parts of the CoAP block-wise option could be expressed as
> 
>      szx = uint .le 6
>      szx .add (uint .bits &(m: 4))

I hope we never reach the point that the C++ template language people reached when they suddenly noticed that it is now Turing equivalent, and that people had started programming in that new programming sublanguage.

But the above is fine if one or more intermediate rules are added — these can make it more obvious what is happening.

>  although one'd pretty quickly run into the need for a .mul / .shift.

I could have used that in draft-ietf-ace-aif, why didn’t you tell me earlier?
(Just kidding.)

>  If such constructions are legal, shouldn't the remark on the targets
>  and controllers being (non-unique) types apply to all of the computed
>  literals?

Yes!

> * On the concatenation conversion between byte and text strings: A
>  corner use case of this would be type conversion, eg.
> 
>      label_unicode = "hello"
>      label_binary = '' .cat label
> 
>  A potential application is constraining a byte-string to valid UTF-8
>  encodings:
> 
>      option_value = '' .cat ("" .cat bstr)

I’m not sure we should let you near a CDDL tool any more.

>  ... but I doubt it warrants pointing out.

It will be an idiom in no time (the "Amsüss hairpin"?).
The nice thing is that idioms like this can be encapsulated in a generic rule, so you could have:

Valid-utf-8-bytes<T> = ‘’ .cat (“” .cat T)

and live happy ever after…

> I'm starting the shepherd writeup next; from the looks of it this will
> be ready to leave the WG with the next published version.

I’ll try my best to get this done by the end of IETF week (not necessarily by the end of IETF).

Grüße, Carsten