Re: [Cbor] Use of cuts in maps

Carsten Bormann <cabocabo@gmail.com> Thu, 08 August 2019 04:40 UTC

Return-Path: <cabocabo@gmail.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 3F3B5120096 for <cbor@ietfa.amsl.com>; Wed, 7 Aug 2019 21:40:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 vEf48yltZY2U for <cbor@ietfa.amsl.com>; Wed, 7 Aug 2019 21:40:57 -0700 (PDT)
Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0C2CA12000E for <cbor@ietf.org>; Wed, 7 Aug 2019 21:40:57 -0700 (PDT)
Received: by mail-wr1-x42a.google.com with SMTP id b3so1088742wro.4 for <cbor@ietf.org>; Wed, 07 Aug 2019 21:40:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=q+pZ6Uvk3qh5db7tiY2WljUVq5Kisxu3tDTVRJTasEM=; b=vRywWV3H1mpsxL8zlzHIabcsEIYBYmQcqaIPeXP3n6fGC5xij5CwES5FoQfrMkvBwX /f8SDyUQN1b5EJjFdET5Xnofmq1LIFmm2ebztwPQXsHm9KAk/KT6IoUHGeI9fcpXxUEm zodEBctTGR+nzCOusB/bJ9XY+X7pQ6ENJnLng849Y+bNS/iuaCmkCNZAkruQh9N1qAVH ou13WuOWndMjQqlIcW4PGETBu/o9Zy492A3hJONa6ZKYg3U4VGAcSZzTxSkpQwEXVe1V XsoqA3pDJ5fJM0PA9K4SgkKyvjYsmcRICLAa2jO193ZqKrwzstX5WJOYZCy/dmR7dba/ KfnQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=q+pZ6Uvk3qh5db7tiY2WljUVq5Kisxu3tDTVRJTasEM=; b=HrbtgA3ZTS+305c9d/oDd0jp+/0bv8SIy4crA/RBBUpg77XLuZBv0MhL5z+fIYyXSL AiBU1JEjTXPZLsvmEf3XxmuvH9yRuG+67FTzL1bBYflh2utG4S+325fZm1sjmE3OP1cm ppSZZYBfFiGubw3BtQpwemcMnWKpZ0CuqbeFsJhfmQ3fBy3Ltt0KxXcSrioTCALj/aBY e+ERvoMtV95bArK63jRcg2k0IY+CIcwPBsDXFjVwKdf06OK9I8M3cTWEnRXz2IMML+FY xYnvpa2+gWjKSrbPJTbmPJ/kAN2Emfqm0bC1O/6Hs4K9gN9DMu5gOkPiC0AtSduNMTBm TIIA==
X-Gm-Message-State: APjAAAWkjiPzTYOSwWLCQFcu7YzwKu6E2EpijukD7wfFXiSwtbxn+RuG nOiRsICO9y1wR5dDcJDr1pc=
X-Google-Smtp-Source: APXvYqze1S42RpdN3BLmSF7/LipLZOjyzMcQzBNrMlIzxlg5ZzF/5+NMZaw0rftQ5qGEHDCdUP3h3Q==
X-Received: by 2002:adf:f206:: with SMTP id p6mr14754407wro.216.1565239255648; Wed, 07 Aug 2019 21:40:55 -0700 (PDT)
Received: from [192.168.217.110] (p548DCCB9.dip0.t-ipconnect.de. [84.141.204.185]) by smtp.gmail.com with ESMTPSA id h16sm108106604wrv.88.2019.08.07.21.40.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 21:40:54 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
From: Carsten Bormann <cabocabo@gmail.com>
In-Reply-To: <001301d54d69$722a3050$567e90f0$@augustcellars.com>
Date: Thu, 08 Aug 2019 06:40:53 +0200
Cc: cbor@ietf.org
X-Mao-Original-Outgoing-Id: 586932048.374261-96cb20b253d42faa4f192dcaa440d729
Content-Transfer-Encoding: quoted-printable
Message-Id: <36B01785-0024-40B3-9CC8-3D28F19174F5@gmail.com>
References: <001301d54d69$722a3050$567e90f0$@augustcellars.com>
To: Jim Schaad <ietf@augustcellars.com>
X-Mailer: Apple Mail (2.3445.9.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/SP6wPQjtBCbfSBTKMQXpUbkoLFg>
Subject: Re: [Cbor] Use of cuts in maps
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: Thu, 08 Aug 2019 04:40:59 -0000

Hi Jim,


> On Aug 7, 2019, at 23:45, Jim Schaad <ietf@augustcellars.com> wrote:
> 
> One of the issues that I have always had with the way that cuts are
> specified in CDDL is that they don't behave the way that I think they should
> in terms of going from the most specific to the most general.  I think that
> I have found a way around this problem and want to verify that it would
> work.
> 
> 
> Start I start with
> 
> map-example = {
>   ? "optional-key" : int,
>   map-example-extensions,
>   * tstr => any
> }
> 
> map-example-extensions = ()
> 
> The next document comes along and does
> 
> map-example-extensions /= (

This would need to be a »//=«.

>   "another-optional-key" : tstr,
>  “and a third": bstr
> )

And these would need a »?« each to be independently optional; right now you are saying they need to be both there.

> 
> If I compile the two modules together, do you believe that this would be a
> match or not?
> 
> { “and a third" : 15 }

With the above changes, this would match the »”and a third”:« and then fail on the bstr post-cut, so the whole map would not match.

I would probably restructure this to:

map-example = {
  ? optional-key : int,
  * map-example-extension,
  * tstr => any
}

map-example-extension = ()

map-example-extension //= (another-optional-key : tstr,)
map-example-extension //= (“and a third”: bstr,)

so further additions can be made without excluding the ones already made.

Grüße, Carsten