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

Wolf McNally <wolf@wolfmcnally.com> Thu, 28 March 2024 01:12 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 A4EDBC14CEFA for <cbor@ietfa.amsl.com>; Wed, 27 Mar 2024 18:12:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.904
X-Spam-Level:
X-Spam-Status: No, score=-1.904 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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 91U5wj2cG_bH for <cbor@ietfa.amsl.com>; Wed, 27 Mar 2024 18:12:55 -0700 (PDT)
Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (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 0AFF7C14F6B3 for <cbor@ietf.org>; Wed, 27 Mar 2024 18:12:54 -0700 (PDT)
Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6e6f4ad4c57so383820b3a.2 for <cbor@ietf.org>; Wed, 27 Mar 2024 18:12:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfmcnally-com.20230601.gappssmtp.com; s=20230601; t=1711588374; x=1712193174; darn=ietf.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eERcBJyCQxfaGmkCXDMMfpXnfE6+H0IpnmYQBxFxWuo=; b=qXgZIMAIqZLSxoradU6UT/1qdqLd1xl9jvzZs0QsSnM6oMav/7jMV2/FkTNzMg1u+f zWxhKIML+z+sgyQwHYJHgkK8kEfCC57caDLt0TQNYUNWjVHOPt0r5m7XzADVAiyS5PJn fOrVOQwym9wFIGGfMWilIzi52HaHrCBPb6+KqfB1O/4Ss15rGBAfudEhcd0zX56+/tGN FI7cUA7MeL3tnrTC/5ISVtI87jy7CbzZJ/IGhScawIoJu2kDI+BGJk0IOEygFk4npep2 yjbPisynxd5dYJCcv1Vj2HnU5vagbdBB066tyBv10Sw/+GivY1xSGoqRAQJ4meDQGerT OSkA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711588374; x=1712193174; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eERcBJyCQxfaGmkCXDMMfpXnfE6+H0IpnmYQBxFxWuo=; b=tSM/Z7vF5O5wIwC6AAvgIEUqicuxWn+uR05O8uNw4wa5XFJRfYCJ5oFoc9G2+YC4bT 6VsW5G84ukdDKLxp2sANQvXmTf7PMFlnalZPiXLMY2daSjloA+A8+Jki5d2Ce0UoEz9Y Xru+WENzK9NcllAAwHkYgkzLY4amDhVMOdnJdq4G8//xY29N8DPBstYwJeCTIVX87UeC sF/x1hvfSvamepEceOn+6gkLiI8Jfe8yK0kgMZqod4SXx98RBKP8Q287OEczjk6aI6jT DNlyjU5SbadZjGqtpjWCN7Ogq1ZylVaaMiFH8fmkdkqXr89LrZgkL38LwS5JJXYjfWRq k0ow==
X-Forwarded-Encrypted: i=1; AJvYcCUHffQeLSU9wpC6v55OI9O2Fdh+ZCpnL8evrrVO/4V615I+wQQ5pLY+90lDi/nW6dNSZmf2Nm3kl/IEX3Me
X-Gm-Message-State: AOJu0YySh2rJ6BpdYcTGJKYagQf3mL7cROLarxvObeluDwwgT6qPzf6I XKXkUMkW5KQvPgcD6tWnnpQTRKv/Dk0qIvc47rHpF4GoZq1oWO0Yq8byD7xlJSS4+CiN2rwdmPf bms0=
X-Google-Smtp-Source: AGHT+IFgqy5oBFidVJSXe972B+Cdoav8sBmKT9yKXUXbAiQ973oFwQVGs8/7JqT4nwW5nmp1/AIfQg==
X-Received: by 2002:a05:6a20:7d86:b0:1a3:bb8b:de7a with SMTP id v6-20020a056a207d8600b001a3bb8bde7amr1674850pzj.54.1711588374213; Wed, 27 Mar 2024 18:12:54 -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 v62-20020a626141000000b006e73f400295sm189682pfb.61.2024.03.27.18.12.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Mar 2024 18:12:53 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
From: Wolf McNally <wolf@wolfmcnally.com>
In-Reply-To: <9A0CE364-C141-4EBE-9703-292C416D12F5@island-resort.com>
Date: Wed, 27 Mar 2024 18:12:41 -0700
Cc: Carsten Bormann <cabo@tzi.org>, "cbor@ietf.org" <cbor@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <6733EB8A-94E4-42C3-9F7C-DC7C6EEA95DF@wolfmcnally.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>
To: "lgl island-resort.com" <lgl@island-resort.com>
X-Mailer: Apple Mail (2.3774.500.171.1.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/RyAkp-R8kC6jvz2EYAQp1GxcYEg>
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:12:59 -0000

LL,

> On Mar 20, 2024, at 11:45 AM, lgl island-resort.com <lgl@island-resort.com> wrote:
> 
> dCBOR disallows the simple value “undefined” and NaN payloads (both are restrictions on the CBOR data model). I believe this is because JSON doesn’t support them. Seems logical that dCBOR might want to disallow maps and arrays as map keys since they are not supported in JSON.

Our design of dCBOR actually has little to do with JSON compatibility: our overriding concern has always been supporting determinism.

dCBOR’s numeric reduction as an analogue to JSON canonicalization of numeric values is a fairly obvious move (IMHO) and they dCBOR does share that in common with canonicalized forms of JSON. However, CBOR also supports NaN, while JSON does not, and as NaN is a useful value in many contexts, and also can easily be made canonical, we chose to include it. CBOR’s `undefined` being semantically indistinguishable from `null` for most practical purposes, and an obvious attempt to export an artifact of JavaScript into serialization, is something that we saw as a source of potential confusion when creating deterministic specifications, so we dropped `undefined`.

For most purposes I wouldn’t recommend map keys be complex. Nonetheless, I can definitely see reasons to have, for instance, vectors of various kinds be map keys. And again, JSON compatibility was a non-goal for dCBOR.

~ Wolf