Quasi-literals for templating?

Gavin Barraclough barraclough at apple.com
Wed Jun 15 17:53:07 PDT 2011


Hi Mike,

I think there may be a bug in the desugaring.  My understanding is that the only arguments to the quasi tag are the call site id & the SVE, and the SVE contains only the substitution values, but in the desugaring example literal portions are being passed to the quasiTag too:

	quasiTag(unguessableId1234, "literalPortion\0 ", x, " literalPortion1"])

I think this should be:

	quasiTag(unguessableId1234, x)

cheers,
G.


On Jun 15, 2011, at 5:49 PM, Mike Samuel wrote:

> 2011/6/15 Axel Rauschmayer <axel at rauschma.de>:
>> Quick feedback: I haven’t seen SVE (substitution value expression?) defined anywhere and can’t find a description of using ${{var}} as syntactic sugar for "{var:${var}}".
> 
> SVE is defined in
> http://wiki.ecmascript.org/doku.php?id=harmony:quasis#substitution_body_syntax
> reproduced below:
> 
> SVE
> 
> Production	 Result
> QuasiLiteral :: QuasiTag`LiteralPortion QuasiLiteralTail	 SVE(QuasiLiteralTail)
> QuasiLiteralTail :: Substitution LiteralPortion QuasiLiteralTail	
> array-concat(single-element-array(SVE(Substitution)),
> SVE(QuasiLiteralTail))
> QuasiLiteralTail :: `	 an empty array
> Substitution :: $Identifier	PrimaryExpression : Identifier
> Substitution :: ${SubstitutionModifier Identifier}	PrimaryExpression
> SubstitutionBody :: Identifier IdentifierPathTail	MemberExpression :
> str-concat(SV(Identifier), SV(IdentifierPathTail))
> IdentifierPathTail :: .IdentifierName IdentifierPathTail	
> str-concat(“.”, SV(IdentifierName), SV(IdentifierPathTail))
> IdentifierPathTail :: ε	 the empty string, ““
> 
> The SVE of a substitution is an expression that is evaluated in the
> scope in which the quasiliteral appears. The SVE of the quasi literal
> is the array of the SVE for each substitution.
> 
> E.g. the SVE of quasitag`literalPortion0 $x literalPortion1 $y.z
> literalPortion2` is [x, y.z].
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list