Exactly where is a RegularExpressionLiteral allowed?

Brendan Eich brendan at mozilla.com
Mon Mar 23 19:17:24 PDT 2009

On Mar 23, 2009, at 7:04 PM, Allen Wirfs-Brock wrote:

>> -----Original Message-----
>> From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>> bounces at mozilla.org] On Behalf Of Brendan Eich
>> Sent: Monday, March 23, 2009 6:39 PM
>>> It should be Literal, not PrimaryExpression. There is no technical
>>> difference (since Literal is only used as one of the alternatives
>>> for PrimaryExpression), but it's just common sense that a
>>> RegularExpressionLiteral is a literal.
>> Agreed, presumably Allen agrees too. It's obvious now that you point
>> it out ;-).
> Homefully I'm relatively agreeable...Strictly speaking  
> RegularExpressionLiteral is now semantically more like an  
> ArrayLiteral or an Object literal

Those are still called Array Initialiser and Object Iniitialiser,  
right? Not to belabor the point, but they aren't literals in the same  
sense, although Object Initialiser's property names are literals  
(constants). These are expression forms with evaluated terms inside  
the bracing.

> in that one of them evaluates to a different object each time it is  
> executed.

That's true, but it doesn't make a literal what it is, in the  
grammatical sense.

> However, I don't think it actually makes much of a difference  
> whether it is a Literal or a PrimaryExpression and since I'm  
> certainly not proposing that we move it from section 7 to section 11  
> at this point in time it probably makes more sense to say it is a  
> Literal.

Cool. That does seem like the minimal change, and it seems worthwhile  
also to keep Literal meaning "lexeme".


More information about the Es-discuss mailing list