Re: Type Coercion is confusing (ISSUE-34)

On 09/28/2011 11:27 AM, Gregg Kellogg wrote:
> In fact, my internal representation is what you suggest. The
> rationale for the existing rep is that it is much shorter, otherwise
> a given type would need to be specified once for each property.

Exactly - we did it this way so that authors wouldn't have to author 
huge chunks of type coercion sections in their markup. Compare this:

{
    "xsd:integer": ["age", "pets", "cars", "children", "siblings"]
}

vs. this:

{
    "age": "xsd:integer",
    "pets": "xsd:integer",
    "cars": "xsd:integer",
    "children": "xsd:integer",
    "siblings": "xsd:integer"
}

Clearly, the first one is more compact and easier to author.

The spec started off doing it the way you suggested, Markus. It got old 
quickly when authoring JSON-LD week after week. As Gregg mentioned, the 
internal guts of a JSON-LD parser will end up using what you suggest 
internally, but we believe the top one is easier for authors and less 
bandwidth intensive.

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny)
Founder/CEO - Digital Bazaar, Inc.
blog: Standardizing Payment Links - Why Online Tipping has Failed
http://manu.sporny.org/2011/payment-links/

Received on Saturday, 1 October 2011 19:53:49 UTC