quasi-literal strawman

Kevin Curtis kevinc1846 at googlemail.com
Tue Dec 22 08:49:15 PST 2009


How about if the developer wants the entire script to be a DSL or an
Alt-JS (compiled in the browser)? (I appreciate this is a different
use-case).

Maybe a way for the alt-JS scanning/parsing code to be automatically
'hooked up' to an alt-JS script? For example - an alt-JS with 'classes
as sugar':

<script type="application/ecmascript;version=6;dsl=http://www.acme.com/mydsl.js">
class Point {
    var x_ = 0;
    var y_ = 0;
    function Point(x,y) {
        x_ = x;
        y_ = y;
    }
    ... //  getters/setters etc.
}
var pt = new Point(1,1);
processPt(pt);
...
</script>

mydsl.js is a 'pure module' which provides an object with scan() and
parse() functions. The compiled mydsl.js is cached for reuse by by
other pages.
Maybe a secure environment could use a similar mechanism. e.g.
"env=http://www.acme.com/ses.js". Meta tags to set DSL/env for the
whole page?


More information about the es-discuss mailing list