Quasi-literals for templating?

Mark S. Miller erights at google.com
Wed Jun 15 09:04:28 PDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110615/2935c962/attachment.html>


More information about the es-discuss mailing list