Re: [Cbor] cbor-packed: Circumfix expansion

Christian Amsüss <christian@amsuess.com> Mon, 01 February 2021 18:22 UTC

Return-Path: <christian@amsuess.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 EA83B3A138C; Mon, 1 Feb 2021 10:22:16 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, 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 kEW_XGW8Qz_d; Mon, 1 Feb 2021 10:22:14 -0800 (PST)
Received: from prometheus.amsuess.com (alt.prometheus.amsuess.com [IPv6:2a01:4f8:190:3064::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 777183A138B; Mon, 1 Feb 2021 10:22:11 -0800 (PST)
Received: from poseidon-mailhub.amsuess.com (unknown [IPv6:2a02:b18:c13b:8010:a800:ff:fede:b1bd]) by prometheus.amsuess.com (Postfix) with ESMTPS id E1B2C407CF; Mon, 1 Feb 2021 19:22:08 +0100 (CET)
Received: from poseidon-mailbox.amsuess.com (hermes.amsuess.com [10.13.13.254]) by poseidon-mailhub.amsuess.com (Postfix) with ESMTP id 152AAFD; Mon, 1 Feb 2021 19:22:07 +0100 (CET)
Received: from hephaistos.amsuess.com (unknown [IPv6:2a02:b18:c13b:8010:7502:722c:4e86:561f]) by poseidon-mailbox.amsuess.com (Postfix) with ESMTPSA id 9C53E44; Mon, 1 Feb 2021 19:22:06 +0100 (CET)
Received: (nullmailer pid 139403 invoked by uid 1000); Mon, 01 Feb 2021 18:22:06 -0000
Date: Mon, 01 Feb 2021 19:22:06 +0100
From: Christian Amsüss <christian@amsuess.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: draft-ietf-cbor-packed@ietf.org, cbor@ietf.org
Message-ID: <YBhGzq2ak+j5Quor@hephaistos.amsuess.com>
References: <YBfspfVS6GzWkWO6@hephaistos.amsuess.com> <C0700EED-C8A9-4826-BD4E-D277BAA4B797@tzi.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="uQTJpSE/bOK7sl+h"
Content-Disposition: inline
In-Reply-To: <C0700EED-C8A9-4826-BD4E-D277BAA4B797@tzi.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/IwZ3rpe7cmqrdAvNt0fwS6DaYqc>
Subject: Re: [Cbor] cbor-packed: Circumfix expansion
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, 01 Feb 2021 18:22:17 -0000

On Mon, Feb 01, 2021 at 01:24:26PM +0100, Carsten Bormann wrote:
> https://tools.ietf.org/html/draft-bormann-lpwan-cbor-template-02
> 
> is the most general form of this that I have written up.
> This assumes that the SCHC environment does the referencing, so it
> only defines the referee (template), not the referent (invocation).
> The example has only one parameter, but could have more.
> 
> Can we package that in a way that is useful for cbor-packed?

Possibly we may first want to do this the other way round -- for what is
a CBOR template other than a CBOR snippet that can be expanded to a full
CBOR item?

The only difference is that unlike in the regular case, the compressor
and uncompressor may not agree on the precise values to be expanded (but
still must on their semantics). The static context would define these
semantics, and the concrete table entries are set from the data the SCHC
environment picks out of whereever.

On a tangent, this opens questions about the applicability to core-href.
(If we can have compressed items that are only semantically but not
contentually agreed on, can core-href semantically always encode full
URIs but have packing tables prepopulated with "the current base
origin", "the current base uri without query parameters" etc?).

> (I do see the complexity issue.)

Come to think of it, if this is done smart, all the complexity of such
an expansion could sit in additional tags that build on cbor-packed.

For a strawman example, a For-Each-Tag could be defined in relatively
simple terms by making it an array [a_0, a_1, ..., a_n], with a_0 used as a
template, and it expands to an m long array (where m is the equal length
of all a_i). Before a_0 is expanded (as it WILL PROBABLY contain Tag-6
items), n-1 shared items are taken from a_1..a_n and injected at the
start of the Current Set.

Such a For-Each tag is clearly more complex in processing than all the
other packing substituion -- but (even if it turns out we want it, which
I don't consider settled) it wouldn't need to be part of cbor-packed,
and wouldn't scare users.

All we'd need to get "right" for this is to be clear about which scoping
rules apply in the recursive expansion for the case that something
between table-setup and item-use meddles with the Current Set. (AFAIU
it's implied by overriding dictionaries being useful, but words like
"dynmaic scoping" and examples should help).

LG
c

-- 
To use raw power is to make yourself infinitely vulnerable to greater powers.
  -- Bene Gesserit axiom