Quasi-literals for templating?

Axel Rauschmayer axel at rauschma.de
Wed Jun 15 09:11:46 PDT 2011


Right, I feel stupid: Even though the literal does not really exist as a reified construct (separate from code), the corresponding code can be executed multiple times.

On Jun 15, 2011, at 18:04 , Mark S. Miller wrote:

> 
> 
> On Wed, Jun 15, 2011 at 8:36 AM, Axel Rauschmayer <axel at rauschma.de> wrote:
> > 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.
> 
> 
> That makes sense. The ID then allows one to do caching. But I don’t see how the same quasi-literal can be “invoked” multiple times.
> 
> At <http://wiki.ecmascript.org/doku.php?id=harmony:quasis#nesting> the inner
> 
>     safehtml`<td>${cell}</td>`
> 
> is invoked multiple times. The safehtml quasiparser can parse the html literal text fragments once and cache something that will accept and plug in data in the remaining hole positions. When the literal text fragments represent code in a substantial DSL, this caching matters.
> 
> 
> 
> --
> Dr. Axel Rauschmayer
> 
> axel at rauschma.de
> twitter.com/rauschma
> 
> home: rauschma.de
> blog: 2ality.com
> 
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 
> 
> 
> -- 
>     Cheers,
>     --MarkM

-- 
Dr. Axel Rauschmayer

axel at rauschma.de
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110615/afba5fc0/attachment.html>


More information about the es-discuss mailing list