Template strings and templates

Axel Rauschmayer axel at rauschma.de
Sun Aug 5 10:06:25 PDT 2012


Perhaps “string template” would actually be better than “template string”: “template” makes sense as “something to fill in” (that is *not* a string, because it can be highly structured, via nesting etc.) and “string” makes sense, because the blanks to fill in are surrounded by strings. The only thing that leads one astray is that templates normally only produce text in the web dev world.

Following the DSL idea, another possibility is:
- quasi literal = domain literal
- quasi literal tag = domain name
- tagged quasi literal = named domain literal
- untagged quasi literal = anonymous domain literal
- quasi handler = domain handler

Again, playing devil’s advocate, I don’t mind “template string”.

On Aug 4, 2012, at 22:22 , Mark Miller <erights at gmail.com> wrote:

> It is a matter of definition and taste, but I don't think it is useful to think of these as macros. I expect macros to extend the base language as if adding new special forms, where these special forms are stylistically similar to the existing special forms. For example
> 
> myfor (x of xs) {
>   print(x);
> } between {
>   print(',');
> }
> 
> or
> 
>     expr ||| expr
> 
> For quasi-literals, first, I agree that "quasi" anything is not a good choice and that "string template" is better. The suggested analogy to other things called templates seems more useful. But best I think would be terminology that suggests that this is a generic DSL embedding mechanism, where you can escape back into the host language from holes in the guest language. The thing to the left of the first backquote, more than anything else names the guest language being embedded. (FWIW, in E we call in It the quasiparser ;).)

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

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


More information about the es-discuss mailing list