Macros: Dangers and Alternatives
Macros allow us to write code that generates other code, making the Lisp languages a wonderful tool for metaprogramming and prototyping new language ideas. But, at some level, macros are just a sleight of hand: They let you trick the Lisp compiler/interpreter into accepting your own customized language constructs and treating them like standard Lisp. They are indeed a powerful tool in a programmer’s tool chest, but they are not as elegant as some of the other programming tools you’ve encountered in this book.
The main drawback of macros is that they can make it hard for other programmers to understand your code. After all, if you’re creating your own language dialect, other programmers won’t be familiar with it. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access