3 ms·
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 n
by kevingadd 13y ago
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.