Specifying template strings
allen at wirfs-brock.com
Wed Jul 9 15:02:40 PDT 2014
On Jul 9, 2014, at 12:41 PM, Rick Waldron wrote:
> On Wed, Jul 9, 2014 at 11:25 AM, Axel Rauschmayer <axel at rauschma.de> wrote:
> I find the specification of template strings still a bit difficult to understand:
> – The abbreviations TV and CV are used 12.2.9, but defined in 188.8.131.52.
> Did you mean TV and TRV?
> This is no different than:
> - String SV and CV
> - Number MV
> Which are all defined in Chapter 11
> – 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?
> – It’d be nice if untagged template strings and tagged templates could be mentioned closer together. They are basically the same thing and this structure seems to be dictated by grammar. To me, template strings are more like tagged templates without a tag. Would it make sense to specify them that way?
They actually aren't the same thing at all. A tagged template literal is a kind of call. A untagged template literal is essentially a string interpolation operation. Different precedence, different semantics.
> (no response, I'll let Allen address these)
The spec. isn't a feature level tutorial. Instead, it is organized around the syntactic and semantic layers of the language and each major feature typically impacts various different parts of the spec.
New lexical (token) level syntax and related semantics go into clause 11. Template Literals (without the tag) are a kind of PrimaryExpression so they belong in 12.2. A tagged template is a kind of MemberExpression so it belongs in 12.3.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss