-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: Verify if Binding is preserved for obj's SetMutableBinding #2094
Conversation
Note that the let scope = { x: 1 };
let handler = {
has(o, p) {
if (p === 'x') {
console.log('hit', Reflect.has(o, p));
}
return Reflect.has(o, p);
},
};
with (new Proxy(scope, handler)) {
(function () {
'use strict';
x = (delete scope.x, 2);
})();
} What should this print / do? In Chrome it prints For a trickier example, consider let scope = { x: 1 };
let first = true;
let handler = {
has(o, p) {
if (p === 'scope') {
return false;
}
console.log('hit');
if (first) {
first = false;
return true;
}
return false;
},
};
with (new Proxy({ x: 1 }, handler)) {
(function () {
'use strict';
x = 2;
})();
} where here the call to |
Can't we perform this check as part of 8.1.1.2.5 SetMutableBinding as proposed in the es-discuss thread? That way it nicely lines up with other strict mode checks in environment records, like for example 8.1.1.2.6 GetBindingValue, step 4 or 8.1.1.1.5 SetMutableBinding, step 2. |
2887245
to
0a0215d
Compare
LGTM! FWIW the proxy issue actually also applies to 8.1.1.2.6 GetBindingValue. |
This has reached consensus today. We need to update the current tests - starting with those pointed out at tc39/test262#427 - and also verify observable implications with Proxies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm editorially
632e7fb
to
ea73966
Compare
This comment has been minimized.
This comment has been minimized.
ea73966
to
019d498
Compare
…tc39#2094) Verify binding existence in the object's SetMutableBinding on Strict Mode. Closes tc39#2093 Ref tc39#467 Ref tc39/test262#427
Verify binding existence in the object's SetMutableBinding on Strict Mode.
Closes #2093
Ref #467
Ref tc39/test262#427