On the ll1-discuss mailing list there has recently been a lot of discussion of lisp-style macros. One of the funnier threads started when Todd Proebsting posted a message with the subject "Macros Make Me Mad":
Defining a macro is often an act of defining a language construct and implementing it. Reasonably or not, I hold language constructs to a higher standard than, say, a mere function definition. Specifically,
- I expect language constructs to be implemented perfectly. I must trust my compiler.
- I expect language constructs to be documented precisely. I must trust the documentation.
Which is a pretty bogus complaint, I thought.
Guy Steele replied with a series of messages of the form
- I expect <language feature> to be implemented perfectly. I must trust my compiler.
- I expect <language feature> to be documented precisely. I must trust the documentation.
My point is not that Todd should lighten up on macros; on the contrary, if anything, I would say he expects too little of those who define functions. All too many programmers *are* really lousy at writing documentation. A library of procedures or methods can constitute just as big an extension to a language as a handful of macros.
Where the line is drawn will depend to some extent not only on the skill level of the programmer but also on the customs and expectations of the community within which the programmer functions. If macros are part of the customary toolset of a community of programmers and there are guidelines and expectations about how they are and are not to be used, and about the level of documentation needed, then they need not be a problem. The same is true of classes, procedures, and algebraic expressions---and there was a time and place in the history of computers when each of these was regarded with similar suspicion by some group of (non-stupid) programmers.
Macros are one of my favorite, and most unique features of lisp. I'm a little touchy when they're criticized, so I'm glad that Steele answered Preobsting's point so well (while still not letting macros completely off the hook).Posted by jjwiseman at November 25, 2002 01:09 PM