Spawn proposal strawman

Brendan Eich brendan at mozilla.com
Tue May 12 00:31:37 PDT 2009


On May 12, 2009, at 12:24 AM, kevin curtis wrote:

> JsonML looks good for for an AST handling:
>
> ["||",
>   ["||",
>     ["Id", "X"],
>     ["Id", "Y"]],
>   ["Id", "Z"]]

Yes.


> Maybe the 'canonical' AST serialized string format could actually be
> more scheme-y:
>
> (or (or X Y) Z)
>
> JsonML could be used for building pure js in-memory AST graphs which
> could then be easily stringified to the 'canonical' format.

JsonML wouldn't be used to build object graphs -- the JSON decoder  
would do that given JsonML in a string, from the AST encoder. That's  
the point I made in the words you bottom-cite about not mandating a  
big fat object graph if the use-case doesn't need the graph, just the  
string containing the AST serialization.


> The benefit is that a scheme-y format could help the thinking on the
> semantics for es6/harmony.

That seems like no benefit in memory use or cycles, only in thinking.  
If you squint, don't the []s turn into ()s? :-P


> (Downside compared to a JSON  canonical format is that with JSON the
> parsing/stringifying is free via the JSON api in es5).

This is a big downside.


> For convenience JSON could remain JSON in this scheme-y format:
> var x = [1,4,5]
> becomes:
> (var x [1,4,5])

I don't see why we'd invent a third language.

/be



More information about the es-discuss mailing list