Better Native XML Support

Russell Leggett russell.leggett at
Tue Jan 17 10:05:18 PST 2012

If you desperately need it, you should be able to make a library for it,
and then if you need the extra syntax, add an extra compile step - like
what coffeescript does. After all, e4x is just an extension to JS, it
should be possible to add the data types natively and then make any e4x
code work as syntactic sugar, which you can desugar yourself.

I'm not saying its an insignificant effort, but it seems fairly
straightforward. The standardized grammar for it is defined as an extension
to Ecmascript after all.

- Russ

On Tue, Jan 17, 2012 at 12:57 PM, Grant Husbands <esdiscuss at>wrote:

> David Bruant wrote:
> > Have a look at quasis [1]. It provides what I'd consider to be a more
> > generic and safer solution to E4X.
> E4X is more than just data production, though. It added a number of
> accessors/syntax for handling XML elements, many of which can be the
> LHS of an assignment:
> expr..ident // descendant selection
> expr. at ident // attribute selection
> expr.* // All-children selection
> expr.(filter) // Filtering a set, with an implicit 'with'
> @ident // At least within a filter, attribute selection
> expr.var::ident // Using the namespace in var, descendant selection
> In combination, they provide some concise ways of manipulating
> document-free XML nodes, though with large number of downsides that
> probably aren't worth covering in detail, here.
> It might be worth considering bringing some of those constructs back
> in a more generic and future-proof fashion in future versions of
> ECMAScript. Or it might instead be worth considering allowing quasis
> to be the LHS of an assignment, which would be useful and could then
> cover more e4x use cases.
> (I've removed es5-discuss from the recipients, since this is no longer
> relevant to that)
> Regards,
> Grant Husbands.
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list