
Metaprogramming: An Introduction to JavaScript (ES6) Proxy - atapas
https://blog.greenroots.info/metaprogramming-an-introduction-to-javascriptes6-proxy-cjwkk64ly000gvds10db4l034
======
SomeOldThrow
These make stack traces a pain in the ass to debug. This kind of magic is
great for prototyping, but I'm very unconvinced it has a general purpose role
in maintainable code.

~~~
Waterluvian
I've been using Immer which relies on proxies to give you a plain object
interface but also copy on write immutability.

It's very nice and I think is a practical example of when proxies make sense.
However it does at times suffer from the cost of doing magic: you handle them
in unusual ways and suddenly they break a lot.

~~~
SomeOldThrow
Yea, you’re right, I can see that working in the right context. These ARE
essentially DSLs, though, so their success largely depends on hard to define
things like documentation, coupling, and quarantining to expected places.

~~~
atapas
Absolutely!

------
quelltext
I wouldn't exactly call Proxies metaprogramming. It's not wrong but it's just
not the best example of what metaprogramming is.

~~~
yvdriess
Proxies trace back their origin in mirrors/mirages in metaprogramming for OO
languages. (shoutout to AmbientTalk) It's a very Smalltalk way of doing
reflection and intersection.

Do you mean that it lacks syntactic abstractions to be called metaprogramming?

~~~
quelltext
The author mentioned that metaprogramming is treating "code as data" which
Proxies themselves don't really do.

------
atapas
Awesome Discussions, Learned from it, Thanks!

------
kyriakos
Looks like PHP magic methods for JavaScript.

