Re: E4H and constructing DOMs

On Mar 7, 2013, at 9:47 AM, Ian Hickson wrote:

> On Thu, 7 Mar 2013, Rick Waldron wrote:
>> 
>> E4H is a language level syntax extension that appears to duplicate the 
>> functionality provided by Template Strings, while restricting usage to a 
>> web/DOM-centric concept (CORS same-origin or Worker context)˜effectively 
>> creating a "version". It also uses one of the remaining unambiguous 
>> ascii characters "@". Granted, it's an interesting experiment, but 
>> Template Strings are capable of "all this and more".
> 
> To be fair, unless they've changed quite substantially since the last time 
> I saw them, quasis don't do the one thing that is E4H's whole point, 
> namely compile-time syntax checking.

There is no reason an implementation (or a platform standard) couldn't define a well known tag function that processes a well specified syntax  (eg, HTML)

   HTML`<label><input type="checkbox" name={name}
              checked?={checked} disabled?={!enabled}/> {label}</label>`

such that a JS implementation could recognize the tag usage at compile-time and statically check the syntax of the statically provided portions of template strings that use that tag.  Alternatively, a lint-like processor could could recognize such tags and produce diagnostics for them. 

In either case, using template strings allows a DSL, such as HTML to be deeply integrated into an implementation without the DSL designer having to deal with the syntactic and semantics subtleties (which are non-trivial) of integrating a DSL into a general purpose language. 

Template strings are now specified in the ES6 working drafts, see:
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6 
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-11.1.9 
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-15.5.3.4 

Received on Thursday, 7 March 2013 18:18:21 UTC