On 7 July 2011 19:35, David Bruant <david.bru...@labri.fr> wrote: >> No, with the current keys default trap (calling >> this.getOwnPropertyNames()) there is no double conversion. Only one at >> the exit of the keys trap. There would be 2 conversions if the "keys" >> trap had the proxy argument (based on >> http://wiki.ecmascript.org/doku.php?id=strawman:handler_access_to_proxy) >> and if internally, the default keys trap was calling >> "Object.getOwnPropertyNames(proxy)" (which would call the trap and do >> type coercion). >> >> But the current implementation and a type coercion only when going out >> of traps would do double-conversion. > "not". "would not do double-conversion", sorry.
I thought the fix we were discussing was changing the `keys' default trap from keys: function() { return this.getOwnPropertyNames().filter( function (name) { return this.getOwnPropertyDescriptor(name).enumerable }.bind(this)); } to something along the lines of keys: function() { return this.getOwnPropertyNames().filter( function (name) { return this.getOwnPropertyDescriptor('' + name).enumerable }.bind(this)); } That would fix passing non-strings to the getOwnPropertyDescriptor trap, but introduce double conversions when you invoke Object.keys. I'm not sure what alternative you are proposing now. /Andreas _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss