Hacker News new | ask | show | jobs
by pygy_ 4390 days 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_proxie...

1 comments

I'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/Refe...
Object.defineProperty allows to overload get/set for a single key at a time.

Harmony proxies catch everything, and really overload the getter/setter mechanism.