Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

More importantly, they reduce the number of characters you have to read and maintain.

Macros allow writing code that's both compact and readable [0], in lesser languages you have to choose.

[0] https://github.com/codr7/cl-redb/blob/ff3a34a31ced7a9668fc95...

[1] https://gist.github.com/codr7/4bb9442c0c66411643eddd8db0164a...



> More importantly, they reduce the number of characters you have to read and maintain.

So does giving all your variable names one-letter names and putting your entire codebase on one line. Surely we can agree that character count is a poor measure of readability or maintainability.

> Macros allow writing code that's both compact and readable [0], in lesser languages you have to choose.

Macros aren't the only abstraction that does that, even within Lisp.


> So does giving all your variable names one-letter names and putting your entire codebase on one line. Surely we can agree that character count is a poor measure of readability or maintainability.

Which is why pg advocates symbol count. (Although he seems to love brevity too.)


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.


> 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.


[flagged]


> > assuming I'm an idiot with no experience

> That's what you're trying hard to look like, unfortunately; if you're not, then stop.

I encourage you to take a deep breath and consider how you would like to treat people before you make future comments on the internet. Perhaps it's unwarranted optimism on my part, but I would guess you want to behave better than this.

I've responded in other comments to everything else you said in this post. You're not saying anything which hasn't been said more kindly by other people in this thread.


Please don't plant booby traps in discussion.

When I mention in a posting the topic of whether or not I'm an idiot and such, that's a signal to people that it's safe to debate that in whatever way they want. (I've been an idiot here and there, and may not be done. I could dig up objective evidence of that and expect people to agree.)

> I've responded in other comments to everything else you said in this post.

Maybe, but not to the message between the lines. Your position can be summarized as "everything is subjective and relative; my negative experience with a tool or technique speaks to the topic in a equally valuable way as do successful experiences by people making something reliable, tested, documented and maintainable by someone other than its author".

That strikes me as objectively untrue, and conductive toward coming to casually dismissive conclusions.

"Well, I think Rust is unproductive (at least for me) because I couldn't figure out the insane compiler messages. But some people who have never seen a type are struck by the novelty. That's okay, 'I like it' is perfectly valid. Everyone's experience is equal!"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: