Proxies basically paper over the numerous weaknesses in Javascript's design by exposing named hooks for things like function calls and property accesses. It's not special or novel - in a language like python the equivalent is mundane things like naming a method __add__ or __getattr__.
It's important for JS, I suppose, because without it a bunch of interesting metaprogramming techniques are impossible and you end up with inferior APIs that have worse performance characteristics. On the other hand, Proxy will probably be slow forever like all corner case JS features, so you really only win on API quality here :(
EDIT: I should mention that Proxies do have some really interesting use cases; sadly the linked post does a terrible job of illustrating any actual reason you'd want to use them.
I recently wrote about a great, and very simple, use case for JS Proxies [1]. They are the cleanest way to implement the mediator pattern in JS, which has some great uses in MVC.
This seems a lot like Lua metatables. I don't know why people don't just give up on JavaShit and just name Lua as EcmaScript v6. It's vastly superior in every possible way.
Normally I like having features like this in a language, but in JS I think it will be just a new tool for the "ninjas" to write crappy unmaintainable with it.
6 comments
[ 2.6 ms ] story [ 21.0 ms ] threadIt's important for JS, I suppose, because without it a bunch of interesting metaprogramming techniques are impossible and you end up with inferior APIs that have worse performance characteristics. On the other hand, Proxy will probably be slow forever like all corner case JS features, so you really only win on API quality here :(
EDIT: I should mention that Proxies do have some really interesting use cases; sadly the linked post does a terrible job of illustrating any actual reason you'd want to use them.
[1]: http://blog.sorentwo.com/2013/12/06/presenting-by-proxy.html