7 ms·
I disagree with you on many points. I do not claim that not using macros means that one cannot use Lisp usefully or profitably. It's a wonderful language even
by reikonomusha 2y ago
I disagree with you on many points.
I do not claim that not using macros means that one cannot use Lisp usefully or profitably. It's a wonderful language even without macros, and I'm sure I'm preaching to the choir by listing all the reasons why.
However, I do think adamantly that the "point" of Lisp really is syntactic abstraction. Why have S-expressions, code-as-data, symbolic data types, etc. otherwise? All of that is there to enable syntactic abstraction.
If out-of-the-box Lisp is sufficient to express solutions to your problems reasonably, then I would wholeheartedly agree to not write macros. But if it doesn't? Well, Lisp is ready to offer a platform to make it happen.
Lisp macros have been given a bad rap because of the plethora of almost useless examples of them. In any beginner book about Lisp, much ink will be spilt in little shorthands, like aif, with-gensyms, etc. Better examples would be actual, real life DSLs people use, like LOOP, lexical analyzers, web server routing, parallelization primitives, static typing, infix notation, etc. Things where gobs of functions and classes don't really capture the best way to denote the solution to a problem.
Learning about macros, then being advised to never use them, to me, is miscommunication at best, a grave misunderstanding at worst.