Quasi-literals for templating?

Axel Rauschmayer axel at rauschma.de
Wed Jun 15 16:48:00 PDT 2011

> 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?
> It would indeed be a problem. How much does this matter?

It only matters if template generation (jQuery templates etc.) works as sketched above. However tests quasis for their ability to support jQuery templates must have a solution in mind that works.

I would expect templating (however it is implemented) to be a frequent use case, given how many templating engines are out there and given how elegant a solution quasi-literals are.

Dr. Axel Rauschmayer

axel at rauschma.de

home: rauschma.de
blog: 2ality.com

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

More information about the es-discuss mailing list