Re: [Cbor] Getting diagnostic notation examples in drafts under control

Carsten Bormann <cabo@tzi.org> Tue, 27 February 2024 10:06 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 F374BC14F683 for <cbor@ietfa.amsl.com>; Tue, 27 Feb 2024 02:06:46 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.908
X-Spam-Level:
X-Spam-Status: No, score=-1.908 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HXjcgyBIJhgV for <cbor@ietfa.amsl.com>; Tue, 27 Feb 2024 02:06:43 -0800 (PST)
Received: from smtp.zfn.uni-bremen.de (smtp.zfn.uni-bremen.de [134.102.50.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 72A18C14F6A9 for <cbor@ietf.org>; Tue, 27 Feb 2024 02:06:41 -0800 (PST)
Received: from eduroam-pool10-028.wlan.uni-bremen.de (eduroam-pool10-028.wlan.uni-bremen.de [134.102.90.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4TkY6k2WzszDCgB; Tue, 27 Feb 2024 11:06:38 +0100 (CET)
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: <97D9FAA8-5EEC-4AA8-8307-96BD1A5884BC@wolfmcnally.com>
Date: Tue, 27 Feb 2024 11:06:37 +0100
Cc: cbor@ietf.org
X-Mao-Original-Outgoing-Id: 730721197.755933-42c27b229fe4812fc354d534ce7db4d1
Content-Transfer-Encoding: quoted-printable
Message-Id: <02654D5F-BEC2-4F30-8F98-A16B0B8D8F5B@tzi.org>
References: <FD64709D-2B97-4DED-9915-331FE7188EE8@tzi.org> <97D9FAA8-5EEC-4AA8-8307-96BD1A5884BC@wolfmcnally.com>
To: Wolf McNally <wolf@wolfmcnally.com>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/EwoZuRzA4Yl4oBErbg9ebteCsgc>
Subject: Re: [Cbor] Getting diagnostic notation examples in drafts under control
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
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, 27 Feb 2024 10:06:47 -0000

Hi Wolf,

On 2024-02-27, at 01:16, Wolf McNally <wolf@wolfmcnally.com> wrote:
> 
> I was wondering about the right way to declare CBOR tag values in a single place and then use them as symbols throughout the rest of my CDDL. For example, something like:
> 
> ```cddl
> tag-my-struct = #6.123456
> 
> ; …
> 
> my-struct = tag-my-struct(
>    bstr .size 32
> )
> ```

This is usually done using generics:

tag-my-struct<T> = #6.123456(T)
my-struct = tag-my-struct<bstr .size 32>

With new syntax coming in ietf-cbor-update-8610-grammar, this could be further unbundled:

tag-my-struct<T> = #6.<my-struct-tag>(T)
my-struct-tag = 123456
my-struct = tag-my-struct<bstr .size 32>

But I don’t think that adds much in this example, so I’d stick with the simple use of generics.

Grüße, Carsten