Specifying template strings

Jason Orendorff jason.orendorff at gmail.com
Thu Jul 10 07:10:43 PDT 2014

On Wed, Jul 9, 2014 at 5:02 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> – Tagged templates are explained via EvaluateCall(tagRef, TemplateLiteral,
>> tailCall). I think it would be easier to understand if it used
>> GetTemplateCallSite.
> Because a Tagged Template is a call. Would it be clearer if there was a note
> that highlighted the fact that the actual TemplateLiteral provides the
> argument list for the call?

This is one of many places where the spec would be greatly improved by
a line or two of explanatory text. Here is an attempt:


A tagged template is an expression such as x`the secret words are ${a}
${b}`. It looks like a string, but it is a kind of function call. It
is evaluated like x(callSite, a, b) where callSite is a call site
object (see, an Array of strings that supplies the textual
parts of the template.

Call site objects are used in the evaluation of tagged templates
(12.3.7). They contain the string parts of a template. Since this
information is always the same for any given template, a single call
site object is created for each tagged template in a program, it is
frozen to prevent modifications, and it is reused each time the tagged
template is evaluated.

There are so many algorithms with no explanatory text at all that it
seems like it must be a deliberate style choice. Is it?

Speaking as a user of the spec, a little prose can be a big help. In
regions of the spec that don't have any, I often feel like I'm reading
uncommented assembly code, reverse-engineering all higher-level


More information about the es-discuss mailing list