2011/12/19 David Bruant <[email protected]> > Le 19/12/2011 11:03, Tom Van Cutsem a écrit : > > (...) > > Separate getPrivate/setPrivate traps would avoid this confusion: > > (...) > One thing that is unsaid in the current proposal is whether private > names can be used with Object.defineProperty and > Object.getOwnPropertyDescriptor. I think that private getters and > setters would be awesome. > But it would mean that the "private handler API" would need to be extend > to 'definePrivateProperty', 'getOwnPrivatePropertyDescriptor' (and > 'deletePrivate' as well)
Good point. That is indeed a major drawback of separating out all private name handling in parallel traps. I think I don't have a problem with widening the type of the name parameter of all of these traps from String to Object. Then a proxy handler can at least test whether it is intercepting a private name or a normal property. The only thing I'm worried about at this point is that there has to be a simple way for the proxy to say "I'm not interested in intercepting this private name, just forward it to my target". Otherwise I'm afraid most proxies will wrongly forward a private name access as a normal property access.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

