Re: [apps-discuss] Concise Binary Object Representation (CBOR)

Carsten Bormann <cabo@tzi.org> Thu, 23 May 2013 16:23 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D093511E812F for <apps-discuss@ietfa.amsl.com>; Thu, 23 May 2013 09:23:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.565
X-Spam-Level:
X-Spam-Status: No, score=-106.565 tagged_above=-999 required=5 tests=[AWL=-0.316, BAYES_00=-2.599, HELO_EQ_DE=0.35, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 84CyD8m6G1bC for <apps-discuss@ietfa.amsl.com>; Thu, 23 May 2013 09:23:20 -0700 (PDT)
Received: from informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) by ietfa.amsl.com (Postfix) with ESMTP id 8FF1211E80EC for <apps-discuss@ietf.org>; Thu, 23 May 2013 09:23:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at informatik.uni-bremen.de
Received: from smtp-fb3.informatik.uni-bremen.de (smtp-fb3.informatik.uni-bremen.de [134.102.224.120]) by informatik.uni-bremen.de (8.14.4/8.14.4) with ESMTP id r4NGNDCF026195; Thu, 23 May 2013 18:23:13 +0200 (CEST)
Received: from [10.0.1.4] (reingewinn.informatik.uni-bremen.de [134.102.218.123]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp-fb3.informatik.uni-bremen.de (Postfix) with ESMTPSA id 48DF83050; Thu, 23 May 2013 18:23:13 +0200 (CEST)
Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\))
Content-Type: text/plain; charset="utf-8"
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <CAK3OfOim44hRaRoFh8vKfK5SPVAnvTGiBV4cizvw30K=ZQPJHQ@mail.gmail.com>
Date: Thu, 23 May 2013 18:23:12 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <84317001-DB56-4DBE-9D1E-A4E605BC07A0@tzi.org>
References: <61CB1D18-BABC-4C77-93E6-A9E8CDA8326B@vpnc.org> <CAK3OfOhVRqUp+xn8mBj8_x8pgubc7bhWebzsFLvoj+ieWmr5gg@mail.gmail.com> <142483A4-2E80-43F1-B3BE-B5B01650BB8F@tzi.org> <CAK3OfOim44hRaRoFh8vKfK5SPVAnvTGiBV4cizvw30K=ZQPJHQ@mail.gmail.com>
To: Nico Williams <nico@cryptonector.com>
X-Mailer: Apple Mail (2.1503)
Cc: Paul Hoffman <paul.hoffman@vpnc.org>, apps-discuss@ietf.org
Subject: Re: [apps-discuss] Concise Binary Object Representation (CBOR)
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 23 May 2013 16:23:27 -0000

On May 23, 2013, at 17:35, Nico Williams <nico@cryptonector.com> wrote:

> On Thu, May 23, 2013 at 2:15 AM, Carsten Bormann <cabo@tzi.org> wrote:
>> On May 23, 2013, at 07:27, Nico Williams <nico@cryptonector.com> wrote:
>> 
>>> - yeah, multiple ways of encoding a given value suck; in particular,
>>> for the JSON-equivalent subset, there should be only doubles, no
>>> floats, no integers
>> 
>> This is about like saying there should only ever be 64-bit integers (or 128-bit, while we are at it).
> 
> ECMAScript specifically only allows that.  That's where the
> restriction comes from.

JSON ≠ JavaScript.  
JavaScript's numbers are IEEE 754 double precision.
That is not at all a property of JSON.  
(It *is* something you care about if one or two of the peers speaking JSON actually are written in JavaScript and you are using JavaScript primitives to operate on the JSON.)

> Many a ECMAScript and/or JSON implementation use NaN coding, which is
> probably why this restriction is there in the first place (though
> that's just a guess; I'm sure there's a list archive somewhere with a
> lengthy discussion I could check; I don't care).

Now you lost me -- JSON doesn't have NaNs.
(Another thing that CBOR has that you can't use in a JSON subset.)

>> The serializer can choose one of multiple representations (or, if it is expedient, it can stick with one).
>> Like with different size of integers, there is little effort in a deserializer to support different sizes of floats.
> 
> I wouldn't insist on having a canonical representation.  I would
> prefer to have a canonical representation if possible.  The biggest
> issue would be the need to sort object keys, which I'd not insist on
> (but it's nice to have the option to, and many a JSON encoder provides
> this).

I think Paul is working on c14n for CBOR.
As I said, I don't want to go there...
(If you think you need c14n, you probably have a bug in your architecture.)

>>> - might as well have a type for "octet string" -- no base64 encoding please
>> 
>> Yes, we are just not using the liturgical name "octet string" :-)
> 
> Yes it's there and I missed it?

Yes, we call them "byte strings" (major type 2).
(They are actually the main reason I started work on CBOR.)

Grüße, Carsten