Re: [Cbor] Unusual map labels, dCBOR and interop

Wolf McNally <wolf@wolfmcnally.com> Thu, 28 March 2024 01:25 UTC

Return-Path: <wolf@wolfmcnally.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 E5FDCC1519AF for <cbor@ietfa.amsl.com>; Wed, 27 Mar 2024 18:25:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.902
X-Spam-Level:
X-Spam-Status: No, score=-1.902 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=wolfmcnally-com.20230601.gappssmtp.com
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 ExPXbGMy2hRb for <cbor@ietfa.amsl.com>; Wed, 27 Mar 2024 18:25:16 -0700 (PDT)
Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 04720C14CEFE for <cbor@ietf.org>; Wed, 27 Mar 2024 18:25:15 -0700 (PDT)
Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3bbbc6b4ed1so262591b6e.2 for <cbor@ietf.org>; Wed, 27 Mar 2024 18:25:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfmcnally-com.20230601.gappssmtp.com; s=20230601; t=1711589115; x=1712193915; darn=ietf.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=iF/vY73/8hD/S/VOyA8OPgehHcX39WGye6B8TZ1+fY4=; b=yJI3xmDejo6VS5lqYjSLn6lCArudbr7rs0wGbbTV3BRxbErxV+b/nMg5mKoRuQT1WI he0uE6Y6ZxwSnebKar6ktbUvv4551EpWy9pp37co/5vWfIYWjHNARZBd0TqhulwxaZYs XTN+zqBCbDZ7UwDGKj5COw9sB1xgZUKtopKvUl5zU5RwNiISvN7T+rzkvHqsM5HXhGxT kjpu80x6Bj3DyLRxbV2FsqanLUOeBKmZzZXeuK+hRHBQPEwryq1BmbdVV4flt4vJjvGR S8gofcWlkhicUmX+an4rqg4zIS1C0ccA7W+Es2iUK6WfY+8jfCZjWgSZnd1NNWxPeWAq uO6w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711589115; x=1712193915; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iF/vY73/8hD/S/VOyA8OPgehHcX39WGye6B8TZ1+fY4=; b=p9KZMuy6pTYY5WDKqQTvBKS00c8yw0EJ8BS35H3FczCQqToFgC6hWiaIdZw9XA6LfJ a9KWNpnsc4y2kXpaKIPGp3KaPeXRkZodoDxrWp4ckAFjKnhRw+sKhNQUVN8vpDgGQsw6 1LX3NSNBkQEGX48D4MgdImyrUWO/Xg757Vg7L2lya+obl0DnUwNsm19itd1kkvYkbtJe ioyhsj3yl8XHNHCu7PuvnH/B6cjU+A6oDnoHgZfJCNZrUkI6V42uo9EGEcjgTEQpDCCB /cMUoxil+9IgLyZ8Va6kMRK8ZdMvOQbXtaJdA0Z16wM1/D84UvGhrRW8Yo5gsTUs/F+/ MTIw==
X-Forwarded-Encrypted: i=1; AJvYcCVKT04HwHf8ETKZJrFLzrBU4DgFMWEfnIdTPEIG75FkMOW02FhM+B92WxdaaLzbMibkVjKxvRkBoaoXOhkF
X-Gm-Message-State: AOJu0Yz9F9184bC/gH0MFurr8+4cFa63s/Rb+Kd0vEjLHBXcsdM9vSkw PrQ7JKl9cwt8nBZSQDn8pCOfStRH3wTOsd5Mxj9qyDBV+LRK8eJdBSx4NZVMdZ1v5UgDndZwNrm MD4w=
X-Google-Smtp-Source: AGHT+IH/FPTEUwWUwcKMFTjxVi9Q6DuWREX3JEF3igDd6WRApIWSKxwmIVhAALPluST9WaGWuSD1kw==
X-Received: by 2002:a05:6870:32ce:b0:221:f921:467e with SMTP id r14-20020a05687032ce00b00221f921467emr1484456oac.21.1711589114761; Wed, 27 Mar 2024 18:25:14 -0700 (PDT)
Received: from smtpclient.apple (ip70-180-193-108.lv.lv.cox.net. [70.180.193.108]) by smtp.gmail.com with ESMTPSA id du9-20020a056a002b4900b006e6b39e040esm182810pfb.165.2024.03.27.18.25.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Mar 2024 18:25:14 -0700 (PDT)
From: Wolf McNally <wolf@wolfmcnally.com>
Message-Id: <5F1E1133-4565-4D0A-98EE-A13C6F5F67AA@wolfmcnally.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_60BAC575-A8E4-46CF-A72B-7796C2F57415"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
Date: Wed, 27 Mar 2024 18:25:02 -0700
In-Reply-To: <58BA8F8C-0C63-4534-9BF7-255C32D02C16@island-resort.com>
Cc: Carsten Bormann <cabo@tzi.org>, "cbor@ietf.org" <cbor@ietf.org>
To: "lgl island-resort.com" <lgl@island-resort.com>
References: <8C245824-1990-4616-AB70-FFD4FACB1AE9@island-resort.com> <11E8A8A5-D891-49FF-AF16-697C06F463B3@tzi.org> <9A0CE364-C141-4EBE-9703-292C416D12F5@island-resort.com> <3D62C4F0-D570-4EE4-AF6A-163C708AA6BE@tzi.org> <58BA8F8C-0C63-4534-9BF7-255C32D02C16@island-resort.com>
X-Mailer: Apple Mail (2.3774.500.171.1.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/VQeYPxKxsV_r7my2HnvnFv93On4>
Subject: Re: [Cbor] Unusual map labels, dCBOR and interop
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: Thu, 28 Mar 2024 01:25:20 -0000

LL,

> On Mar 24, 2024, at 12:21 PM, lgl island-resort.com <lgl@island-resort.com> wrote:
> 
> For dCBOR, I’d like to see map labels very restricted. I’m not a JSON user/expert, but it is a Jupiter-sized data point for me. It has massive use with only string labels. 
> 
> I’ll propose integers and strings (major types 0-3) to start discussion. Maps and arrays seem too much. Only strings might be OK.

I’m not sure whether the issue you’re having is coming from a place of design advice, or implementation complexity. From a protocol design perspective, in the vast majority of cases I agree that using integers or strings for map keys makes the most sense. From an implementation perspective, our code simply incrementally manages maps by using the serialized CBOR of a key as the “real” key and keeps the map in sorted order, even though it hides this fact from the user. This lets us skip the sorting step during serialization, and facilitates the validation step during deserialization. It also lets us support arbitrary map keys per the CBOR spec. Obviously this isn’t the only approach that works to keeping the serialized map supported, its keys unique, and also support complex keys.

> I can imagine many use cases other than the Gordian Envelope finding dCBOR highly desirable because it eliminates all the CBOR stuff that is variable and a lot of stuff that is hard to understand. Most people aren’t as smart or as into this stuff as we are. Simple map labels line up with this.

Again, the goal of dCBOR wasn’t “simple CBOR,” although it has some of that flavor, but “deterministic CBOR” as its name suggests, and I’ve kept that foremost in the design choices I made in its specification. I can see why someone might define an “sCBOR” protocol that further restricts dCBOR, but inasmuch as dCBOR meets its original goals, I don’t see the point of restricting it further.

~ Wolf