Le 19/12/2012 16:34, Brandon Benvie a écrit :
That's easily solved by making the accessor have a null prototype and frozen though.
True, but it makes that you can't re-apply these getters and setters with .call. Since the getter doesn't inherit from Function.prototype any longer, you have to go through

    Function.prototype.call.call(webIDLGetter, context)

or

    var call = Function.prototype.call.bind(Function.prototype.call);
    call(webIDLGetter, context);

Since recontextualizing getter/setter is probably one of their main use case, I wish this wasn't the chosen solution. I'd like to point out that recently on Twitter, Eddy Bruel, (who among other things implemented direct proxies on SpiderMonkey) shared his trouble understanding the Function.prototype.call.bind trick [1] If he has trouble, I'm sure thousands (millions?) of less educated JS devs will do too.

I prefer the configurable:true solution so far.

David

[1] https://twitter.com/ejpbruel/status/276747606951071744
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to