-
Notifications
You must be signed in to change notification settings - Fork 48
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
get handler with Symbol #57
Comments
Symbols are not supported by this shim, as they are not available in ES5. Can you provide a little more info about your environment? Are you using a tool like babeljs to compile to ES5 or a runtime that already provides support for Symbols? |
I am using iojs v2.3.4 (--harmony --harmony_arrow_functions --harmony_proxies) and I haven't tried babeljs yet but I don't see any information about proxies support on their web site. |
I'll try to replicate and see what the behavior is. If v8's Symbol implementation is incompatible with its Proxy implementation, there is little this shim can do. But perhaps the issue lies in my library code and can be fixed. Babeljs indeed does not support proxies, but it does support Symbols. It could have been the case that you were using Babeljs Symbols, compiled down to ES5 and then using node or iojs --harmony_proxies to run that code. I'm not sure how Babeljs compiles symbols to ES5 but I suspect it would not lead to the desired semantics. |
|
As I had expected, it seems V8's Symbols and built-in Proxies don't play well together: I tested the following using var p = Proxy.create({
get: function(receiver, name) {
console.log(typeof name);
return name;
},
set: function(receiver, name, val) {
console.log(typeof name);
}
});
var s = Symbol("x");
p[s] = 42;
console.log(p[s]); Note that this code doesn't even use this library but just uses the old pre-ES6 Proxy API directly. The above code doesn't even trigger the Proxy get/set traps, and the last line just logs I'm not sure to what extent my shim can add support for Symbols if built-in Proxies don't work with them. For now, I'll note the incompatibility in the README. Thanks for reporting. |
Not sure if folks are still interested in this, but I filed a v8 bug on this (https://code.google.com/p/v8/issues/detail?id=4537&thanks=4537&ts=1446787325) |
I fail to use the Proxy get handler with a ES6 Symbol as property name:
The text was updated successfully, but these errors were encountered: