Template strings and templates

Mark Miller erights at gmail.com
Sat Aug 4 13:22:07 PDT 2012


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 ;).)



  Cheers
  --MarkM

On Aug 4, 2012, at 10:41 AM, John J Barton <johnjbarton at johnjbarton.com> wrote:

> 
> 
> On Fri, Aug 3, 2012 at 10:30 PM, Axel Rauschmayer <axel at rauschma.de> wrote:
> Ah, OK. Spitballing: A synonym of tag then, maybe? Alas, label is out. If the term was, say, “mark” then one could conceivably say “mark function” instead of handler.
> 
> Aren't these macros?
> 
> tag`literal${substitution}literal`
> 
> macro`literal${substitution}literal` 
> 
> The default or passthru macro applies when the developer does not supply a macro.
> 
> Or if you prefer
> 
> macro_function`a macro with ${substitution} here`
> 
> Then we don't have to spend several years explaining how template strings are templates but not <template>s and aren't string templates because they take non-string substitutions.
> 
> (IMO oxymoronic quasi-literal is embarrassing). 
> 
> jjb
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120804/0b1dba53/attachment.html>


More information about the es-discuss mailing list