6 ms·
Partly Yes. If they are used correctly, then they are fine, but often they are used to create all kinds of hidden side effects - sometimes even global side effe
by jonathanstrange 7y ago
Partly Yes. If they are used correctly, then they are fine, but often they are used to create all kinds of hidden side effects - sometimes even global side effects.
The other issue is that macro authors tend to create embedded DSLs. That makes the code hard to understand, unmaintainable and write-only-once in the long run.
Strangely, I find the Scheme and Lisp community to be pretty good at creating reasonable macros. (With exceptions, I'm not a fan of the LOOP macro.) Maybe that's because they use them less for syntactic sugar and more for really expanding the language. Still, there are too many DSLs and you can be lucky if you understand your own CL code ten years later.
- vram22 7y agoThanks. I have the same feeling about the tendency in Ruby to use magic tricks. Prefer the Python way, although it does have support for meta-programming, etc. People tend to write magic code less in Python, AFAIK.