Quasi-literals for templating?

Mike Samuel mikesamuel at gmail.com
Mon Jun 13 23:01:29 PDT 2011


2011/6/12 Axel Rauschmayer <axel at rauschma.de>:
> http://wiki.ecmascript.org/doku.php?id=harmony:quasis
>
> Quasi-literals look like they could be used for templating (similar to jQuery templating [1]). For example, to turn JSON data into HTML.

Yep.  Take a look at
http://js-quasis-libraries-and-repl.googlecode.com/svn/trunk/index.html
and try selecting "Safe HTML" from the dropdown at the top-right.

I'm also trying to make sure that the jquery templates spec (
http://wiki.jqueryui.com/w/page/37898666/Template ) integrates well.

> Has that been considered as a use case (e.g. after a compilation/generation step?). But it doesn’t seem like identifier names are accessible to quasi handlers, which would make this difficult.

If the consensus ends up being that more than simple identifiers are
allowed in substitutions, then I don't know what it would mean for
identifiers to be available.

But more meta-data could be attached to the call site object.

> BTW: “Desugaring” at the beginning of “Semantics” seems mangled.

Thanks.  Will fix.

> [1] http://api.jquery.com/template
>
> Axel
>
> --
> 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
>


More information about the es-discuss mailing list