[Cbor] Re: Dealing with -0.0, NaN, and Infinity

Anders Rundgren <anders.rundgren.net@gmail.com> Wed, 21 August 2024 13:08 UTC

Return-Path: <anders.rundgren.net@gmail.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 372A4C14F696 for <cbor@ietfa.amsl.com>; Wed, 21 Aug 2024 06:08:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.108
X-Spam-Level:
X-Spam-Status: No, score=-7.108 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, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 eIZrFh-T-p8x for <cbor@ietfa.amsl.com>; Wed, 21 Aug 2024 06:08:27 -0700 (PDT)
Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DB8C3C14F60A for <cbor@ietf.org>; Wed, 21 Aug 2024 06:08:27 -0700 (PDT)
Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-428119da952so54126955e9.0 for <cbor@ietf.org>; Wed, 21 Aug 2024 06:08:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724245706; x=1724850506; darn=ietf.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+G3W65bpd1Ndk4yCAhGauMpEAvQkjS9lD01qJc5sMSc=; b=SVC2jJVPNQdpDlMvotTRDh2nhw6pvS9leEx+jAOJnPvOUHovvCX/whulVI0ZY6EVB0 kSLjw/syY2dRmtsVuOXzS4Vy6PdUwFuzufevQXX2oZjAp/w81I8ymjU/f3NrT7F0DB7N 8YTGGm9C06EFVfZRPLFR353QQgd4WArdMYOgVreompNGiLfM1jVpKAXLOIp9bczfy5NV s2Lq9cIBWefkhcMCi/vG1c3DceMkhS3r4BnD0ae+ZkplBfze1pIPcimDG+UydlwV5Tde lvnJm5hYweEjX2QkftFH7yzEDP0udlpMq5PnKB3hL5FsuJR7VbyUBORbDqewlkXI/Gaa /qww==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724245706; x=1724850506; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+G3W65bpd1Ndk4yCAhGauMpEAvQkjS9lD01qJc5sMSc=; b=AdnVvwS0AUWfne8vDx6iC/X7B0BXDurGMO6j14I2M5F7RScldAQT+7F/vgfbvnkABo lgd6JNl63siqNuA+hPnkKZAfsuMiZmEtX+csv0pFbtWuHJ6qDSBayOAHX+5duYym9Doo DKJJ9ALVtpoyD4qvyBoEUpEDLRJt5U4AA3y5qZbtZx/tA+6i2sxyOvGqNkoo7Ew3dBbM maE2seLYq4oxwWH2K267/otDCkLAWNyXtw9KS+DLSum7BPQp1tkLzfOjX3N9hdhOn+kA ZXcGw+kTDkuV2ikhYyYPK0l53dYE8v24DyQw7x1quF28CCNPQBcu6q4fD1AYrYeGnauH iFPQ==
X-Gm-Message-State: AOJu0YwUN/saB1AR8FOVxxoXcL1EjqNG4ZQr3MCtwv42iPpJUz9JBd+G huK++aLb6E+M1EayXxEzOlgCpxFT2yVBc2lNG3z2BYNcFGhUqBwCUjJunw==
X-Google-Smtp-Source: AGHT+IEmKOrZvI4hlF8fxVzxz1Z+azOvqjaHlXxttlILlIE75uI3Vl5kLmU0YHB4TR4z+1SrvgQOXg==
X-Received: by 2002:a05:600c:35c8:b0:426:602d:a243 with SMTP id 5b1f17b1804b1-42abf062702mr15417835e9.16.1724245705835; Wed, 21 Aug 2024 06:08:25 -0700 (PDT)
Received: from ?IPV6:2a01:e0a:e1b:64b0:8563:213:eece:478? ([2a01:e0a:e1b:64b0:8563:213:eece:478]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42ab87e881csm52585525e9.1.2024.08.21.06.08.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Aug 2024 06:08:25 -0700 (PDT)
Message-ID: <9e9a14cc-7730-4fb2-8e84-42cbdb72891f@gmail.com>
Date: Wed, 21 Aug 2024 15:08:24 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Carsten Bormann <cabo@tzi.org>
References: <17c394aa-095b-4a6d-95ee-0741b6b166f8@gmail.com> <2869DB6E-61BD-42D8-80B4-AA909C978B56@tzi.org> <fcdf23a9-fb0f-48d2-b141-dce1d634b6d9@gmail.com> <193D8044-AFBD-4C67-914C-7C17918C077D@tzi.org>
Content-Language: en-US
From: Anders Rundgren <anders.rundgren.net@gmail.com>
In-Reply-To: <193D8044-AFBD-4C67-914C-7C17918C077D@tzi.org>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Message-ID-Hash: LQ6CSA6GOW7AEK722PELWC6UCTGSVMEX
X-Message-ID-Hash: LQ6CSA6GOW7AEK722PELWC6UCTGSVMEX
X-MailFrom: anders.rundgren.net@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cbor.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: "cbor@ietf.org" <cbor@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [Cbor] Re: Dealing with -0.0, NaN, and Infinity
List-Id: "Concise Binary Object Representation (CBOR)" <cbor.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/6PdrYbqUuIdd5maqUtH6taCqJ-Q>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Owner: <mailto:cbor-owner@ietf.org>
List-Post: <mailto:cbor@ietf.org>
List-Subscribe: <mailto:cbor-join@ietf.org>
List-Unsubscribe: <mailto:cbor-leave@ietf.org>

On 2024-08-21 14:43, Carsten Bormann wrote:
> On 2024-08-21, at 12:44, Anders Rundgren <anders.rundgren.net@gmail.com> wrote:
>>

<snip>

>>
>> There is no question, it just emphasizes how an ES "CBOR" object could be a better mousetrap than the current ES "JSON" object.  It is called "marketing" :)
> 
> Ah.  Certainly adding direct support (i.e., outside of other libraries that already need it) for CBOR to JavaScript would make a lot of sense.
> BTW, I don’t think adding a ton of booleans to a constructor is a great way to handle different application requirements here (and describing the normal, non-CDE case by the “marketing” word “lenient” also doesn’t help).

Do you any other solution in mind?  When thinking more about it (thanx!), this seems like an excellent place for a "builder" like API pattern:

let decoder = CBOR.initExtended(cbor).rejectNaNs(true).somethingElse(arg) etc etc.

Better?

Anders

> 
> Grüße, Carsten
>