Hacker News new | ask | show | jobs
by codr7 1155 days ago
I urge you to try that theory on the expansion linked in my comment and see where it takes you compared to the macro code.

No, but it's the most effective one.

1 comments

> No, but it's the most effective one.

That's a perfectly valid opinion which is probably based on your experience, just as my opinion that macros aren't a good tradeoff is based on my experience.

I understand the initial joy of macros, and I'm well aware they're powerful for generating code. But in my experience, they are also not well encapsulated, and as a result, areas of code which use macros tend towards being write-only, where the code becomes hard to read and you're afraid to make changes lest the fragile pile of expansions you've created comes crashing down. In the short run, they seem great, but in the long run, the errors they create don't seem worth it.

I don't know why I've experienced this and you haven't, but I'm sure you have some different experience with macros that leads you to have a different feeling on macros than I do. If you disagree with me, I'd appreciate it if you approached that disagreement without making without assuming I'm an idiot with no experience, and without making arguments like "fewer characters = better" which even you don't believe.

You're right, I do think macros make a good tradeoff. And you're not alone in thinking otherwise, I remember attending a heated panel debate at the International Common Lisp Conference about the pros and cons of macros.

In my case it's based on 20-ish years of using Common Lisp for personal projects.

Admittedly mostly prototyping and figuring things out, but that's my main use case for CL since using it at work is mostly politically impossible.