News for hackers. Stuff that matters.
Re:Use cases for ES6 proxies by qwertyuiop924 on Wednesday July 20, 2016 @07:35AM (#12128215)
On the contrary, I can think of tons of uses for proxies, from Ruby-style MethodMissing, to object.observe functionality.
Re:Use cases for ES6 proxies by spion on Thursday July 21, 2016 @10:41AM (#12137155)
For a dynamic set of properties, an observable dictionary is better. For a fixed and known set of properties, its possible to enumerate them with "@observable" decorators beforehand (e.g. see MobX)

Method missing is an alternative to proxies, not a feature.

IMO, a lot of use cases for proxies are mistakes and/or better handled without them.

Re:Use cases for ES6 proxies by qwertyuiop924 on Thursday July 21, 2016 @05:11PM (#12140107)
What? No. MethodMissing is far more limited than proxies. Proxies are effectively a far more complex version of Python's properties.

@observable isn't part of the language, and indeed may use proxies under the surface.

Re:Use cases for ES6 proxies by spion on Thursday July 21, 2016 @05:41PM (#12140305)
Yes, method missing is a far more limited alternative to proxies. But its not a use case for proxies, they just have intersecting sets of use cases. It doesn't make sense to "just" implement method_missing, you would do that so that you can implement other things on top of method_missing.

@observable does not need proxies. Only implementing operator[] does. Which also could've been done with a far more limited feature, namely adding a symbol for the [] method.

Proxies are just silly.