

Meta-programming JavaScript Using Proxies - gdi2290
http://www.dzautner.com/blog/2013/12/31/metaprogramming-javascript-using-proxies/#yolo

======
pselbert
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.

[1]: [http://blog.sorentwo.com/2013/12/06/presenting-by-
proxy.html](http://blog.sorentwo.com/2013/12/06/presenting-by-proxy.html)

------
evilpie
Please note that he seems to be using the old Proxy API.

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

------
zmanian
I didn't understand what was special/novel about Proxies at all.

~~~
kevingadd
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.

