Re: [Cbor] dCBOR moving from numerically-typeless systems
Wolf McNally <wolf@wolfmcnally.com> Sun, 12 March 2023 21:15 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 D4073C151535 for <cbor@ietfa.amsl.com>; Sun, 12 Mar 2023 14:15:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.897
X-Spam-Level:
X-Spam-Status: No, score=-6.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=wolfmcnally-com.20210112.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 z89Fwqfd6hdX for <cbor@ietfa.amsl.com>; Sun, 12 Mar 2023 14:15:31 -0700 (PDT)
Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (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 9B57DC15152E for <cbor@ietf.org>; Sun, 12 Mar 2023 14:15:31 -0700 (PDT)
Received: by mail-ot1-x32c.google.com with SMTP id r23-20020a05683001d700b00690eb18529fso5761415ota.1 for <cbor@ietf.org>; Sun, 12 Mar 2023 14:15:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfmcnally-com.20210112.gappssmtp.com; s=20210112; t=1678655731; 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=voDDXVgFTGbIAudfHpFkkgK+s/d3rzGa261TTQkfOwE=; b=0FUkPVvpZzOam8PBZHlW9KjRD5EIGPKL0xUisfxX8Z5E6pOnnM1BxIS3utdD4ReAK4 cSHcKWTYLiyTcbqXm3Pb2ZPGi9jlCKTNURLbUzvCFU6QnPjWZ70GhkKMLE5HuMYsN0Ab /2lfPsvXDPa8A8xmMFlR4dJ3Ms4b9pekpF6VwPcxFE3w1xozsA4aaI+z/eC+YNuiq64N uGTcknMmZ7FaKgGRCpP2CkFVyyHL9/gJg4lHJQjC4nEVCtHBnF4sUvCtC08Ru9YZDLi4 MLJTMDPG+sIax3zhDyt3f/IWEtQefipAEWQHC8AdTnFfDBUHIersifikWpRLw7KmKWhd gEeg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678655731; 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=voDDXVgFTGbIAudfHpFkkgK+s/d3rzGa261TTQkfOwE=; b=q3wASoCUZ5Q7my3rj4z3GJdZFgGNoaxg+K36zxqJ6h+XZJRuR7dmCEtIavNpU/ymXs BQu8dmvh6taZ1xLO61rOquZblHo1x4RtAOLIwqwpfseAL1hJ2oewAt8bi+lQVNzJToVk 4HjLKiw7cOblqU10ap841LBWgr2gmyXUb2nrX6t/cjQz7dq7CXvV7G2cRafI7dxxz6Yz VbJ3J66XyyHMU7WsE0NNpMggpG3UC4dxNmoPea5ixVikiTTITgwKOrTfD9lYlJ04wmIW RIFRrNc5ovQ6Dz6qAYcGT7DQNU9QXRGFK1Tv7/+vXVeCIm1xLOaGWuk+0cqjOHiXBIev 1dFw==
X-Gm-Message-State: AO0yUKVEfeBk/fZuUsXkPH28c6y7smSPu00s7sZolhwyiBbnRuHVjdAJ KHAJc8wroMbVT5qIu2gqgvw4LQ==
X-Google-Smtp-Source: AK7set/fKCN5ZFoGxl/QoJU/8TuCjqk5CkrnJuEknCjZgOysQDxX/WO4AnG4FqZqhzQnPcL7qxhXeQ==
X-Received: by 2002:a9d:19a3:0:b0:694:7e8f:2547 with SMTP id k32-20020a9d19a3000000b006947e8f2547mr10773256otk.22.1678655730763; Sun, 12 Mar 2023 14:15:30 -0700 (PDT)
Received: from smtpclient.apple ([185.222.243.89]) by smtp.gmail.com with ESMTPSA id i18-20020a9d6112000000b0068bcef4f543sm2496698otj.21.2023.03.12.14.15.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2023 14:15:30 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\))
From: Wolf McNally <wolf@wolfmcnally.com>
In-Reply-To: <7AAE85BD-AD41-445C-B747-B80523B068ED@tzi.org>
Date: Sun, 12 Mar 2023 14:15:18 -0700
Cc: cbor@ietf.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <BE2033A9-502D-4412-AF8F-79503354A765@wolfmcnally.com>
References: <2B1FA8CC-AD83-4E58-BE27-B6504F555694@wolfmcnally.com> <8551021E-A1A2-4764-B0DF-D3E7591EC9B6@tzi.org> <FD5D8771-E1CF-4C63-A141-054DE0085399@wolfmcnally.com> <D714A0A4-7452-4C45-8542-7A57A75C9748@tzi.org> <35A71381-A9DD-479C-A7D5-9B06F70B6F50@wolfmcnally.com> <3CE988BD-C87E-4A0C-ADA8-79124FE1FB51@tzi.org> <382FB8D4-03B8-4B92-B7BA-B3760D77D258@wolfmcnally.com> <7AAE85BD-AD41-445C-B747-B80523B068ED@tzi.org>
To: Carsten Bormann <cabo@tzi.org>
X-Mailer: Apple Mail (2.3731.400.51.1.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/XydZhgbuF54skZV9wscxR2hneSM>
Subject: Re: [Cbor] dCBOR moving from numerically-typeless systems
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: Sun, 12 Mar 2023 21:15:33 -0000
Carsten, > On Mar 12, 2023, at 1:47 PM, Carsten Bormann <cabo@tzi.org> wrote: > > On 2023-03-12, at 21:34, Wolf McNally <wolf@wolfmcnally.com> wrote: >> >> semantically `null` expresses the absence of a value > > This is the “big assumption” that I’m not convinced of. > > This can get way more complicated, even with 0xf7 “undefined” being around as well. > > Exhibit 1: > > https://github.com/svaarala/cbor-specs/blob/master/cbor-absent-tag.rst > > But, yes, in CBOR we can always invent more values to express various forms of not-being-there, being-mostly-absent, keeping-a-position-occupied-but-not-taken, … > (Harder to do in JSON.) We even have NaN :-) > > Grüße, Carsten > So, I’ve been struggling to come up with compelling arguments *for* `null`-valued key-value pairs in maps. I decided to ask GPT-3: > Wolf: In programming languages, what does `null` or `nil` represent? > > GPT-3: `null` or `nil` represent an empty value or a lack of value. They are usually used to indicate the absence of a value when no other value is applicable. > > Wolf: Is there any semantic difference between a key-value pair where the value is `null` and the absence of the key-value pair itself? > > GPT-3: Yes, there is a semantic difference. A key-value pair with a value of `null` indicates that the absence of a value is intentional and meaningful, whereas the absence of a key-value pair altogether indicates that the value is simply not present. > > Wolf: Give an example. > > GPT-3: For example, consider a dictionary of user preferences. If a user has not specified a particular preference, the key-value pair may not exist at all. However, if a user actively chooses to not specify a particular preference, the key-value pair can exist with a value of `null`. This indicates that the user has made an active choice and is not simply omitting the preference by default. > > Wolf: Why would that make any *functional* difference in how the application behaves? > > GPT-3: Depending on how the application is programmed, the presence of a `null` value could trigger a particular response. For example, if the application needs to display a message when a particular preference has not been set, it could use the presence of the `null` value as a signal to display that message. In this case, the `null` value provides additional functionality to the application. > > Wolf: But if the preference has not been set, the key-value pair itself could simply be omitted. > > GPT-3: Omitting the key-value pair would not provide the same functionality as setting it to `null`. While omitting the key-value pair would indicate the absence of a preference, setting it to `null` would allow the application to make a distinction between an absence of preference and an actively chosen preference of nothing. > > Wolf: What is the best argument that a `null`-valued key-value pair should *alway* be omitted if the desired goal is a deterministic encoding? > > GPT-3: The best argument against using a `null`-valued key-value pair to represent an absence of preference is that it introduces additional complexity and ambiguity into the encoding. By leaving out the key-value pair altogether, the encoding remains deterministic and unambiguous, ensuring that the application behaves in a consistent manner. > > Wolf: What is the best argument for allowing `null`-valued key-value pairs to exist in a deterministic encoding? > > GPT-3: The best argument for using `null`-valued key-value pairs is that it allows for the introduction of additional functionality. In some cases, the presence of a `null` value can indicate a particular state or choice, enabling the application to take specific actions or display specific messages based on the value. For example, if an application needs to display a message when a particular preference has not been set, setting the value to `null` can indicate that the user has not specified a preference, and the application can behave accordingly. > > Wolf: Allowing `null`-valued key-value pairs necessarily creates a three-valued case, correct? > > GPT-3: Yes, allowing `null`-valued key-value pairs creates a three-valued case where the value can be either explicitly present, explicitly absent, or explicitly undefined. This allows for additional functionality in the encoding, since the application can take different actions based on the value of the key-value pair. And with that, gentlemen, I have for the first time lost an argument with artificial intelligence. I’ll concede the point that `null`-valued key-value pairs should not be disallowed on grounds of well-formedness, but aver that they require explicit allowance by the specifier, and if not so specified that they are to be considered out of range values during semantic validation. The dCBOR extraction API will also need to be enhanced to report whether the value contained in a map is absent, or affirmatively `null`. While this does put additional cognitive burden on the implementer, I haven’t successfully argued that it has no possible utility. ~ Wolf
- [Cbor] dCBOR moving from numerically-typeless sys… Wolf McNally
- Re: [Cbor] dCBOR moving from numerically-typeless… Carsten Bormann
- Re: [Cbor] dCBOR moving from numerically-typeless… Wolf McNally
- Re: [Cbor] dCBOR moving from numerically-typeless… Carsten Bormann
- Re: [Cbor] dCBOR moving from numerically-typeless… Wolf McNally
- Re: [Cbor] dCBOR moving from numerically-typeless… Carsten Bormann
- Re: [Cbor] dCBOR moving from numerically-typeless… Wolf McNally
- Re: [Cbor] dCBOR moving from numerically-typeless… Carsten Bormann
- Re: [Cbor] dCBOR moving from numerically-typeless… Wolf McNally
- Re: [Cbor] dCBOR moving from numerically-typeless… Wolf McNally
- Re: [Cbor] dCBOR moving from numerically-typeless… Carsten Bormann
- Re: [Cbor] dCBOR moving from numerically-typeless… Wolf McNally