Re: [Cbor] Handling duplicate map keys

Laurence Lundblade <lgl@island-resort.com> Sat, 23 November 2019 17:11 UTC

Return-Path: <lgl@island-resort.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 80F3212082A for <cbor@ietfa.amsl.com>; Sat, 23 Nov 2019 09:11:25 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.895
X-Spam-Level:
X-Spam-Status: No, score=-1.895 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zLy0kY4eHRUM for <cbor@ietfa.amsl.com>; Sat, 23 Nov 2019 09:11:24 -0800 (PST)
Received: from p3plsmtpa06-06.prod.phx3.secureserver.net (p3plsmtpa06-06.prod.phx3.secureserver.net [173.201.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 8D9AF120133 for <cbor@ietf.org>; Sat, 23 Nov 2019 09:11:24 -0800 (PST)
Received: from [10.86.0.74] ([45.56.150.43]) by :SMTPAUTH: with ESMTPA id YYwNiPM5FtvENYYwOiSCd6; Sat, 23 Nov 2019 10:11:24 -0700
From: Laurence Lundblade <lgl@island-resort.com>
Message-Id: <92F6E676-5669-46C1-9C4E-54719BBB5A7F@island-resort.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_561B23A6-03D4-477A-83F4-E69DE0C41133"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Date: Sat, 23 Nov 2019 09:11:23 -0800
In-Reply-To: <F81E1A57-6072-44FA-A148-8F3ED7520791@island-resort.com>
Cc: Jeffrey Yasskin <jyasskin=40google.com@dmarc.ietf.org>, cbor@ietf.org
To: Jeffrey Yasskin <jyasskin@chromium.org>
References: <CANh-dX=EVDa4EwrgWKof4kCD3nkfV3BvH0Cg5ZKOivmXJ_Dm8g@mail.gmail.com> <E5C74E1F-A5F4-4AB8-9787-3999C4697C3B@island-resort.com> <CANh-dX=1gkAtfSG-yzCsVAkk=oLM-=dN_JLCr1kQK3d6Jb0fSw@mail.gmail.com> <F81E1A57-6072-44FA-A148-8F3ED7520791@island-resort.com>
X-Mailer: Apple Mail (2.3445.104.11)
X-CMAE-Envelope: MS4wfECwjPyTizuA8Xc0QwQ/vej0lxAaKW19fXhyR2RMBCipTKfzUm1+rFriLCkDvTcV03vP2XQukFY3hlZBtCa0/3g2bBNl3fkTUrw9aBf+uFkFXyshApOb RG4Aq6jLRzU4d7ExCt4GYUlEHXpWTfxLvXuU09gCmXBJtdgzOVHABRjCJ4g7lilbExbSR2thx+bGIgzPjwFNsyKFNPxT47vAfIrl1NiHLIyUGMRqmzBJ5pui JlLipyS6CEVL/Gxg5D6qfw==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/ib-ABqvcubp2OqVrknf8ArBxljg>
Subject: Re: [Cbor] Handling duplicate map keys
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
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: Sat, 23 Nov 2019 17:11:25 -0000


> On Nov 23, 2019, at 7:21 AM, Laurence Lundblade <lgl@island-resort.com> wrote:
> 
> To say it more in prose: They should either use a generic CBOR decoder that errors out on duplicates, or a CBOR decoder that passes duplicates up so the protocol implementation on top of CBOR can do the detection. What they must not do is use a decoder that does take first, take last or randomly takes one of the occurrences.

To be really explicit (for my brain too), it is never right for normal behavior of a CBOR protocol to rely on take first. It is *always* right to error out when duplicates are detected.

LL