Fun impossible Firefox JS challenge

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Apr 12 11:53:33 PDT 2012


On Apr 12, 2012, at 10:51 AM, Brendan Eich wrote:

> Yes! IE and Firefox agree! :-P
> 
> I'm not suggesting "we" win, just glad not to be all alone on this one. ;-) Thanks for testing.
> 
> Allen, your thoughts?

The IE9 console.log syntax error (I see it too) seem like a bug under any interpretation of the ES5.1 spec.
My second test case actually isn't very good. console.log(fals\u0065) is actually a reference error in chrome and safari.  This is the expected behavior when referencing an undeclared variable. So they are also de-keywordizing in that context.
FF alerts "false" so it it interpreting the fals\u0065 in this context as the keyword and not as an Identifier.


So, FF (>= 4??) and IE9 don't seem to support unicode escape based de-keywordization and the web doesn't appear to have collapsed.  That seems like a good indication that this isn't a major interp. concern and we can think about what we want such unicode escapes to mean rather than being forced to adopt something.

Personally, I think the de-keywordization interpretation is pretty ugly.  It is taking something (unicode escapes) that presumably exist for specific purpose (a way to insert arbitrary Unicode code units into source text) and loads a secondary semantics upon them. I think that ES5 has already covered the important use cases for contextual non-keyword interpretation of reserved words.  If we want to allow declarations that create bindings for reserved words (not something I favor) then we should address that head-on rather than via a ugly backdoor. 

I think we should stick with the ES5 intent (Unicode escapes don't change the meaning of an IdentiferName, including keywords) and possibly clarify the Es6 spec. language to make this intent even clearer. 

Allen




> 
> /be
> 
> Domenic Denicola wrote:
>> var tru\u0065; =>  "Expected identifier" error in IE9.
>> console.log(fals\u0065) =>  "Syntax error" in IE9.
>> 
>> Can test IE10 when I get home from work.
>> ________________________________________
>> From: es-discuss-bounces at mozilla.org [es-discuss-bounces at mozilla.org] on behalf of Brendan Eich [brendan at mozilla.org]
>> Sent: Thursday, April 12, 2012 13:38
>> To: Allen Wirfs-Brock
>> Cc: es-discuss Steen
>> Subject: Re: Fun impossible Firefox JS challenge
>> 
>> Allen Wirfs-Brock wrote:
>>> 1) Understand the actual browser interop situation. For example, do
>>> all major browsers accept:
>>>       var tru\u0065;
>> 
>> SpiderMonkey shell:
>> 
>> js>  var tru\u0065;
>> typein:1: SyntaxError: missing variable name:
>> typein:1: var tru\u0065;
>> typein:1: ....^
>> 
>> It looks like Carakan (Opera), JSC and V8 allow this. I can't test IE.
>> 
>>> 2) Within the constraints of 1) decide what we actually want to
>>> specify.  Do we want
>>>       console.log(fals\u0065)
>>> to print "false" or "undefined"?
>> 
>> Carakan, JSC and V8 alert "undefined".
>> 
>> Anyone have IE results?
>> 
>> Looks like SpiderMonkey implemented ES5 not ES3, probably accidentally
>> and ahead of time.
>> 
>> /be
>> 
>> 
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>> 
>> 
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>> 
> 



More information about the es-discuss mailing list