Template strings and templates

Claus Reinke claus.reinke at talk21.com
Sun Aug 5 13:51:29 PDT 2012


>> need to communicate that they are not limited to strings, though: 
>> template parameters and tag results can be arbitrary ES objects/values.
> 
> I chose "template string" over "string template"  to emphasize that it was 
> a template that was expressed as a string rather than a template for a 
> string.  That may be too subtle of a distinction.  At the TC39 there were 
> some concerns that simply "template" was too general and might cause 
> confusion relative to other templating mechanism. 

The naming distinction is too subtle, but the "template is a string" 
explanation applies to both versions. I was not asking for more name 
bikeshedding, and the initial applications seem to be for generating 
strings.

It might be sufficient if tutorials involving template strings would 
feature at least one example with non-string result and arguments, 
to indicate that there is more to them.

Hmm, I see myself wanting to refer to the strings involved in a 
template, and I wouldn't want to talk about "template string strings".

We could also try to accompany the name with a concise description.

    ES6 tagged template:
    A template string, filled with expression parameters, result 
    depends on the tag handler (function) consuming both.

Claus
 


More information about the es-discuss mailing list