Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

__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...



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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: