Hacker News new | ask | show | jobs
by dcherman 2702 days ago
I agree. While you can accomplish some really interesting things with Proxy, I think that this article presents some poor examples that are actively harmful. I don't expect `delete` to be O(N) (actually worse if you consider the `ownKeys` implementation. I don't expect setting a property (sort) to invoke an expensive sorting operation. The list keeps going.

While I appreciate what the author is trying to accomplish, I think this is an example of what not to do as far as code is concerned.

Most of my practical usage of Proxies to date have been limited to some debugging tools that I wrote for AngularJS to help detect property changes that occur outside of a digest cycle. Don't think I've had any use cases that I've shipped to production code yet, though I believe Vue is considering using proxies for their reactivity model in the future to avoid the need for `Vue.get` and `Vue.set` for previous unknown properties or deletions.

1 comments

I particularly like the ``JSON.stringify({ name: "Albert Einstein" }) in dbProxy``.