ietf
[Top] [All Lists]

Re: [apps-discuss] Gen-ART review of draft-bormann-cbor-04

2013-08-13 09:30:19
On Aug 13, 2013, at 13:14, Tony Finch <dot(_at_)dotat(_dot_)at> wrote:

Type tags don't really need to
be part of the serialization format: they can be encoded in a simpler
format by the application. 

Yes, and we also can get rid of maps {"a": 1, "b": 2}.

Just represent them as arrays of two-element arrays [["a", 1], ["b", 2]].
Or, actually, as arrays where the even-indexed elements are the keys ["a", 1, 
"b", 2].
(This is, in the end, close to what happens in the encoder anyway.)

There is a reason why we provide some type tagging (here: distinguish arrays 
and maps) in the encoding: The decoder may be able to factor out some common 
handling that otherwise would need to be done on the application.

In other words, removing maps in the name of simplicity just moves the 
complexity elsewhere, in this case to the application.

Now, the application may already be prepared to handle the complexity, and if 
you come from a JSON world, you are probably *used* to having it handle the 
equivalent of CBOR's tags in the application: JSON doesn't have tags.  
Supporting applications that do that is a reason why the use of tags is 
optional.

Grüße, Carsten