Re: [Cbor] dCBOR moving from numerically-typeless systems

Carsten Bormann <cabo@tzi.org> Sun, 12 March 2023 13:46 UTC

Return-Path: <cabo@tzi.org>
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 4EB97C14CF18 for <cbor@ietfa.amsl.com>; Sun, 12 Mar 2023 06:46:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 znQjg69kyI8x for <cbor@ietfa.amsl.com>; Sun, 12 Mar 2023 06:46:04 -0700 (PDT)
Received: from smtp.uni-bremen.de (smtp-old.zfn.uni-bremen.de [134.102.50.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 0F1FAC14F747 for <cbor@ietf.org>; Sun, 12 Mar 2023 06:46:03 -0700 (PDT)
Received: from [192.168.217.124] (p548dc9a4.dip0.t-ipconnect.de [84.141.201.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.uni-bremen.de (Postfix) with ESMTPSA id 4PZLfK14jdzDCbM; Sun, 12 Mar 2023 14:46:01 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <35A71381-A9DD-479C-A7D5-9B06F70B6F50@wolfmcnally.com>
Date: Sun, 12 Mar 2023 14:46:00 +0100
Cc: cbor@ietf.org
X-Mao-Original-Outgoing-Id: 700321560.765522-6fc7e72e57cc3d6f1e76809acb25fe53
Content-Transfer-Encoding: quoted-printable
Message-Id: <3CE988BD-C87E-4A0C-ADA8-79124FE1FB51@tzi.org>
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>
To: Wolf McNally <wolf@wolfmcnally.com>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/z3dmrbYzsIWTCl7--KISQYW3jfk>
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 13:46:06 -0000

On 2023-03-12, at 12:49, Wolf McNally <wolf@wolfmcnally.com> wrote:
> 
> Carsten,
> 
>> On Mar 12, 2023, at 3:26 AM, Carsten Bormann <cabo@tzi.org> wrote:
>> ...maybe you can explain your “no `null` in map entry values” rule next.  Isn’t that really very much about how the application processes these values?
> 
> Just like numeric values have multiple equivalent CBOR representations, map entries with “no value” also have two semantically-equivalent representations:
> 
> • omit the entry entirely, or
> • encode the entry, but give it a `null` value.
> 
> If these representations are semantically equivalent,

Big assumption.

I think you are assuming that all map entries have default values, and that all default values are `null`.

What if your default value is 10?

If course, you can use `null` as a secondary representation of that default value, unless the map entry actually has defined semantics for (non-default) `null`; you may choose to exclude such application data models, and you are.

However, if 10 is the actual default value, it is the application that needs to ensure it never expresses this value (as default values must never be expressed in deterministic representation). 

You are essentially doing half of the work in the encoder (the part that suppresses `null` if it is the default value), and leaving the other half to the application (suppressing 10).  This is at the cost of not supporting data models at all where `null` is not the default value.

I find this weird.

Grüße, Carsten