Assignment of global variables deleted by their RHS in strict mode

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Aug 27 16:12:21 UTC 2015


On Aug 27, 2015, at 1:03 AM, André Bargull wrote:

>> A fix for this would be in 8.1.1.4.5, insert between the current steps 4 and 5:
>> 
>> 4.5  If S is true, then
>>        a.   Let stillHasBinding be ObjRec.HasBinding(N).
>>        b.   ReturnIfAbrupt(stillHasBinding).
>>        c.   If stillHasBinding is false,  throw a ReferenceError exception.
> 
> I think the check should go into 8.1.1.2.5 SetMutableBinding. That way the similar issue for object
> environment records gets also fixed:
> 
> ```
> var scope = {x: 1};
> 
> with (scope) {
>  (function() {
>    "use strict";
>    x = (delete scope.x, 2);
>  })();
> }
> ```
> 
> Except for SpiderMonkey, all other engines tested (Edge, Nashorn, JSC, V8) already throw a
> ReferenceError for the above snippet. But that's probably because engines don't implement the
> 'correct' Reference type semantics (https://bugs.ecmascript.org/show_bug.cgi?id=4379).
> 
> 
> - André
> 

I think you are probably right. In which case it becomes step 2.5 in 8.1.1.2.5

Allen




More information about the es-discuss mailing list