[uf-rest] Introducing JAHAH

Bob Ippolito bob at redivi.com
Fri Jan 6 22:14:14 PST 2006


On Jan 6, 2006, at 9:43 PM, Kevin Marks wrote:

>
> On Jan 5, 2006, at 6:00 PM, Bob Ippolito wrote:
>
>>
>> On Jan 5, 2006, at 5:30 PM, Dr. Ernie Prabhakar wrote:
>>
>>>>> So, has anyone done a JSON<->XOXO bridge?
>>>>
>>>> I'm not terribly sure why you'd want to do it, the use cases are  
>>>> pretty different and they're definitely not 1:1 on features.   
>>>> JSON has no canonical hyperlink representation, and XOXO has no  
>>>> canonical representation for null, numbers, booleans, or  
>>>> string:value maps.  JSON is the plist equivalent for the web.   
>>>> In fact, it's awfully close in syntax to old-style NeXT plists  
>>>> (minus timestamps and data).
>>>
>>> Hmm, not sure what happened to my previous message.  Anyway,  
>>> hopefully this will answer your question:
>>>
>>> http://www.opendarwin.org/~drernie/xoxo-datatypes.html
>>>
>>> There's even a demo about it here:
>>>
>>> http://opendarwin.org/~drernie/C499496031/E20051026153908/index.html
>>
>> I'd drop double, float, and integer in place of a single number  
>> type: let's call it number.  The recommended implementation for  
>> Number would be a 64-bit floating point number (C double).  This  
>> is parity with JavaScript's Number type, Python's float, etc. and  
>> has enough bits to represent any number in either of your three  
>> types.  I'd also explicitly specify what to do with Inf, -Inf, and  
>> NaN; either make them invalid to have in a document, or  
>> represented as strings in some way.  If valid, the aforementioned  
>> spellings are convenient because that's what JavaScript understands.
>
> Normally I'd agree with you - I am a big fan of duck typing - but  
> it depends on the goal. If it is to provide a safe way to round  
> trip data, we may need to consider the strongly typed languages  
> too. Sometimes integers are what you want to avoid rounding glitches.

Normally I'd agree with you too, if you weren't totally wrong ;)

64-bit double precision representation does NOT have any rounding  
glitches whatsoever in the domain of 32-bit integers.  All of the  
proposed integer types have been exactly 32 bits long because that is  
the predominant integer type available.  In fact, some platforms can  
not exactly represent larger integers with a built-in type, except in  
floating point.

-bob



More information about the microformats-rest mailing list