Re:Metaprogramming: An Introduction to JavaScript (ES6) Proxy
by SomeOldThrow on Wednesday June 12, 2019 @10:49PM
(#20171453)
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.
Re:Metaprogramming: An Introduction to JavaScript (ES6) Proxy
by codingvelocity on Wednesday June 12, 2019 @11:08PM
(#20171520)
You're quite correct. My team just inherited a large node codebase that had proxy sprinkled everywhere, complete with a custom undocumented dsl written using proxies. It was a nightmare to learn, hard to extend without breaking and resulted in quite a few refactoring sessions.
I think proxies have their place, but most apps don't need them imo
Re:Metaprogramming: An Introduction to JavaScript (ES6) Proxy
by Waterluvian on Thursday June 13, 2019 @02:39AM
(#20172336)
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.
Re:Metaprogramming: An Introduction to JavaScript (ES6) Proxy
by SomeOldThrow on Friday June 14, 2019 @12:03AM
(#20180496)
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.
Re:Metaprogramming: An Introduction to JavaScript (ES6) Proxy
by atapas on Sunday June 16, 2019 @01:59AM
(#20194062)
If I understood correctly, The Reflection part of the Metaprogramming can be broken further into multiple parts like,
- Introspection: Code is able to inspect itself
- Self-Modification
- Intercession: Acting behalf of somebody else
To me, Proxy is more into the category of 'Intercession', isn't it?
Re:Metaprogramming: An Introduction to JavaScript (ES6) Proxy
by yvdriess on Thursday June 13, 2019 @08:02AM
(#20173899)
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?
I think proxies have their place, but most apps don't need them imo
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.
To me, Proxy is more into the category of 'Intercession', isn't it?
Do you mean that it lacks syntactic abstractions to be called metaprogramming?