Re: HTML as application manifest format

On Thu, 01 Aug 2013 17:57:20 +0100, Tab Atkins Jr. <jackalmage@gmail.com>
wrote:

> HTML is the Web's serialization format *for HTML, and other text-like
> things*.  As Kornel's example shows, HTML is *not* well suited to
> holding key/value pairs or the like;

The ugly part is current lack of support for nested groups of metatags,  
but HTML is pretty good at nesting in general, so this can be fixed easily  
(I've proposed <metagroup> and <permission> in passing).

OTOH JSON is by design set in stone, so you can't relax parsing even to  
fix the merge-conflict-inducing trailing comma, you can't add language  
attribute to values, you can't add proper comments.

Here's a very interesting post about hacking JSON format, motivated by  
pains of using JSON for configuration:

http://fadefade.com/json-comments.html

Comments are irrelevant for data serialization/exchange when JSON is spit  
by software (and this is where JSON shines), but become a necessity in  
files that humans have to carefully maintain.

When files are written by hand (and config files most often are) people  
can abuse the syntax. The comment hack proposed in aforementioned article  
makes JSON-with-comments incompatible with ES5 JSON and turns  
underspecified quirk and implementation detail into de-facto standard.

JSON left out comments deliberately to avoid deteriorating by having a  
hacky extension point, and now a hacky extension point has been found...

> you have to hack them in via ugly
> <meta> values, and you don't get any of the benefit of the rest of
> HTML, because <meta>/<link> *is all you're doing*.

Actually, if I could define app's metadata and web components all in one  
file that would be awesome:

<link rel="import manifest" href="/">

(and for added awesomeness I'd make that file my homepage, so I can have  
self-contained 1-request web app, and subpages that get the manifest and  
components from the page that is most likely to be cached).

> This is quite different from Templates, because those are actually
> leveraging HTML, and so using HTML as the delivery format as well just
> reduces impedance mismatch.  I don't think that applies here.  JSON is
> the way the web does key/value transmission.

JSON is fantastic for bare key/value transmission (uncommented,  
unlocalized automatic data dump), but manifest is not just a basic  
key/value transmission. Locales tree-patching-dictionary in the spec shows  
that manifest already has impedance mismatch with JSON data model.

-- 
regards, Kornel

Received on Tuesday, 6 August 2013 17:32:14 UTC