Ah, very clever. It’d be nice to have an example of using this to compile 
templates (like jQuery templates). Maybe not even the implementation, just a 
quasi literal and why it works.

var myTmpl = tmpl`Dear ${{first}} ${{last}}`; // (*)
alert(myTempl.render({ first: "Jane", last: "Doe" }));

The handler (at (*)) is called like this:
tmpl(callSiteId73654, { first: undefined }, { last: undefined });

BTW: won’t it be a problem (for this use case) if the variables first and last 
don’t exist?

On Jun 16, 2011, at 1:31 , Mark S. Miller wrote:

> 
> 
> On Wed, Jun 15, 2011 at 4:16 PM, Axel Rauschmayer <[email protected]> wrote:
> Quick feedback: I haven’t seen SVE (substitution value expression?) defined 
> anywhere and can’t find a description of using ${{var}} as syntactic sugar 
> for "{var:${var}}".
> 
> At <http://wiki.ecmascript.org/doku.php?id=harmony:destructuring#issues>:
> 
> The shorthand {x, y} for {x: x, y: y} allowed on the left-hand side of 
> assignment should be allowed on the right too ...
> 
> This shorthand has nothing to do with quasis per se. It's just a convenient 
> expression syntax. So if we allow more expression syntaxes to appear between 
> `...${ and }...` and if this "more" includes this specific syntax, then we 
> can compose then to give the requested information conveniently without 
> violating alpha-rename-ability.
> 
>  
> 
> 
> On Jun 15, 2011, at 20:42 , Mike Samuel wrote:
> 
> > 2011/6/15 Brendan Eich <[email protected]>:
> >> The point is that the callSiteId captures all the 
> >> literal/constant/loop-invariant parts of the quasi, both raw and cooked 
> >> ("expandedLP"). The remaining quasi handler parameters are the necessarily 
> >> variable, evaluated-at-runtime substitution expression results.
> >>
> >> The proposal needs to say this a bit more explicitly, and up front.
> >
> > Added http://wiki.ecmascript.org/doku.php?id=harmony:quasis#callsiteid
> > and renamed rawLP and unescapedLP.
> >
> 
> --
> Dr. Axel Rauschmayer
> 
> [email protected]
> twitter.com/rauschma
> 
> home: rauschma.de
> blog: 2ality.com
> 
> 
> 
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
> 
> 
> 
> -- 
>     Cheers,
>     --MarkM

-- 
Dr. Axel Rauschmayer

[email protected]
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to