2 ms·
__getattr__ and friends allow to customize the getters and setters. JavaScript is in the process of getting similar capabilities with Harmony proxies, but the
by pygy_ 12y ago
__getattr__ and friends allow to customize the getters and setters.
JavaScript is in the process of getting similar capabilities with Harmony proxies, but the spec has yet to be finalized: http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxie...
- jonpacker 12y agoI'm slightly confused by your wording but I think the functionality you're referring to is already available via Object.defineProperty's "get" and "set" options: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- pygy_ 12y agoObject.defineProperty allows to overload get/set for a single key at a time. Harmony proxies catch everything, and really overload the getter/setter mechanism.