W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2013

Re: E4H and constructing DOMs

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Thu, 7 Mar 2013 10:17:49 -0800
Cc: Rick Waldron <waldron.rick@gmail.com>, Ojan Vafai <ojan@chromium.org>, Adam Barth <abarth@chromium.org>, "rafaelw@chromium.org" <rafaelw@chromium.org>, Adam Klein <adamk@chromium.org>, Anne van Kesteren <annevk@annevk.nl>, Alex Russell <slightlyoff@chromium.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-Id: <6F669480-F6A5-4979-9FCC-B906281453E3@wirfs-brock.com>
To: Ian Hickson <ian@hixie.ch>

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:

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:08 UTC