Re: [Cbor] Consolidated set of tags for map-like entities

Emile Cormier <> Tue, 16 March 2021 18:38 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id B6EF63A0EAD for <>; Tue, 16 Mar 2021 11:38:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.096
X-Spam-Status: No, score=-2.096 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id eO_73AV3cxYG for <>; Tue, 16 Mar 2021 11:38:57 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 2BAE83A0E6F for <>; Tue, 16 Mar 2021 11:38:53 -0700 (PDT)
Received: by with SMTP id x21so8117667pfa.3 for <>; Tue, 16 Mar 2021 11:38:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a9SOVk3SmrxHawKy57e0ClONtODKqImvUP9Xk009qi8=; b=gLJsyfAJhODamCqBd+CFozr4D13SqmmilEoRNudGZlaoLvYI4LGT0WGBp/XW3RNw5+ jntFxbn6gfZqN6XJZESUYg5pMY5s2JvKumV8wDOzH4n8U5tky2090w0iA/mtqJKsB/DL uD3wzqd2wF7DcXKdB8Tgxa0KVU9ma9+6hTFZlQZjNoxTdBzZrYMpw0kJSVdklfeaHcN+ Cy/YTc48aCccWn63MVNqj4lbcylvzJhX6773vvXEApFLLFEmGfViqbfJwLV/0ONbB7E7 4eNK3cisyTlYapalhkQhqKntcMuQHBBAimF5+u0w1ijRYfMEfCOAqW+8lqiPXCOsIYdi AVFQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a9SOVk3SmrxHawKy57e0ClONtODKqImvUP9Xk009qi8=; b=tIhvFx1bvJa4MpqkZmts7QkuXSRNVxOGKF/bCQEbYa5BS/ycE7UBCjhEQd12zY/0gt XlAe4j4/mtnwZDtl1ahSDaZwUbTuA5ryMUbeHx9t3JscKjz7QEsTejZcFiNOmUGPA7db Fx1yoyjavq1uZMrpC6d5lhxs5yhQ6u9tsHvmIevoJAjj7uJGWYBw/lgupxgMucqQ5FMD 8SHGKPn1aakSL9P/ur6269ikypfdJsmsg+hy+kJtN4tQXnDkvk5ZB55fec7UuL7om+dG xHS66HxzjFFFet0pdFNY5gRufYkQFqI2gFzcm+VsB+jwKaPCfmEiyzaK6EzK5K26kuLL 68EA==
X-Gm-Message-State: AOAM533ZhFJ66WHSxilu3lj2dC6BU9kYclNqIUdNZgZ52NxtK/CyGTOv Q7cPTN21POF6OeLA4FGwrGOJpvfafzzktO3xU8YespBCtyPRBA==
X-Google-Smtp-Source: ABdhPJw3lA+xkoVGzj1V0yCFgRX+FfdBv04F7dgxzTQGNwDNAB7MPLGzTmy7VtoFn3lhDnzFYTRe3i4LBKnEwlMcT+0=
X-Received: by 2002:aa7:9824:0:b029:1ef:2104:c72d with SMTP id q4-20020aa798240000b02901ef2104c72dmr847954pfl.20.1615919931614; Tue, 16 Mar 2021 11:38:51 -0700 (PDT)
MIME-Version: 1.0
References: <> <> <>
In-Reply-To: <>
From: Emile Cormier <>
Date: Tue, 16 Mar 2021 15:38:40 -0300
Message-ID: <>
To: Kio Smallwood <>
Content-Type: multipart/alternative; boundary="000000000000826aa905bdabad92"
Archived-At: <>
Subject: Re: [Cbor] Consolidated set of tags for map-like entities
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Tue, 16 Mar 2021 18:39:05 -0000

RFC8746 has this to say about homogeneous arrays:

Which CBOR data items constitute elements of the same application type is
> specific to the application.

I think this interpretation of "homogenous" should be the same for this

On Tue, Mar 16, 2021 at 2:36 PM Emile Cormier <>

> Hi Kio,
> I'll add an information section on how the various tags relate to
> programming language data structures. I could start with JS and C++ data
> structures, and allow other folks to send or PR me the ones for other
> languages.
> For homogeneous key/values, it was actually my intention that the first
> key/value encountered "establishes" the type for the remainder. A decoder
> could reject a homogenous map where a key/value does not match the type
> established by the first.
> You've made me realize that the interpretation for "homogenous" could be
> tricky for numeric types. For example, if the first homogenous key is a
> positive integer, can the decoder assume that the following keys may also
> include negative integers and floats? I'll check what it says for
> homogenous arrays in . It may have
> already been settled there.
> This also begs the question: what does "homogeneous" mean for key/value
> types that are themselves arrays or maps?
> Thanks for the feedback!
> Emile
> On Mon, Mar 15, 2021 at 4:36 PM Kio Smallwood <>
> wrote:
>> Hi Emile,
>> Thanks for enumerating all of the possibilities. I have a few thoughts:
>> * Would it be worth noting which programming languages and environments
>> already make use of each type? For example, users of the cbor2 python
>> library would only see tag 128 (equivalent to major type 5) tag 129, 130,
>> for ordered and multimaps, and 132 when inter-operating with
>> javascript/json. The rest would be very strange to encounter in a Python
>> datastructure.
>> * For the Homogeneous keys/values, should we (codec implementers) assume
>> that the type of the first key/value encountered in the data item
>> determines the type of the remainder?
>> Thanks,
>> Kio
>> On 2021-03-12 23:50, Emile Cormier wrote:
>> Hi Everyone,
>> I've been corresponding privately with Prof. Bormann about a new tag I
>> proposed for encoding multimaps as arrays or pairs. He's made me aware of
>> your recent discussion about another proposed tag for encoding "ordered"
>> maps, where the insertion order must be preserved. Carsten has indicated to
>> me his desire to consolidate all of these map-related tags together.
>> I would like to contribute to this endeavor of consolidating map-related
>> tags. To get the discussion started, I would like to share with you a draft
>> proposal I've written to serve as a starting point:
>> Here's a brief summary:
>>> This document proposes a consolidated set of CBOR tags for map-like
>>> entities involving key-value pairs. These tags encode the following
>>> meta-data concerning map-like entities:
>>>    - the homogeneity of the key and value types,
>>>    - the preservation of the insertion order of the key-value pairs,
>>>    - the uniqueness of the keys, and,
>>>    - the major type used to encode the key-value pairs.
>> My interest in CBOR stems from my work on a new C++ serialization library
>> that can support any JSON-like encoding. This library is closed source for
>> now, but I may be able to convince my employer to make it open source in
>> the future.
>> I'm also involved with the WAMP protocol, which allows CBOR as one of its
>> encodings.
>> I'm looking forward to collaborating with you and I hope that we can come
>> to a solution that satisfies everyone's needs.
>> Cheers,
>> Emile Cormier
>> _______________________________________________
>> CBOR mailing list