Channels ▼

Bil Lewis

Dr. Dobb's Bloggers

Macros Considered Harmful (International Lisp Conference, 2009)

March 25, 2009

The grandious title of the debate that was to happen at the International
Lisp Conference (50 years!) at MIT that night.

I had skipped work and paid my own way in. ($250 for four days?! Deal!!!!) 

Bunch of friends. Some people I idolize. Lots of eager youngesters
with their ideas, hopes, and dreams. This was cool. RMS* even showed up
for a brief stint.

I wasn't planning on signing on for a "Lightning Talk," but Henry
Lieberman talked me into it. I like talking, but at the same time....

Wow. I have five minutes to say something coherent about debugging
while running a demo. And they cut you off in mid-word if you go
over. That adds a bit of adrenline into the system.

I had all night to prepare, after all.

The debate...

It was RPG*, Dan Wienweb, JonL*, and oh, what's his name!

The great QUUX* moderated.

What's his name proposed the above slogan. He made a series of
intelligent and very serious arguments for why macros cause more
problems than they solve. The opposition pretty much said "Freedom!
Power! Personal Responsibility!"

This is a Lisp crowd, so it got a little roudy. Lispers *love* their

And yet, the arguments were cogent. Especially in Lisp, where macros
can have side-effects that change how later files will be compiled.

Arguments against: 

"We have experienced so many problems with side-effects in macros that
we in the Lisp world cannot do a reliable incremental build." No one
really disagreed.

"Macros obscure the code. They're easy to write, but hard to
read. Your code will be more understandable in six months if you don't
use macros." This point evoked debate. "Macros allow me to say more
clearly what I intend."--"That's fine for you now, but it will become
black magic to anyone else reading your code."

"Macros are really hard to write correctly. And you probably won't be
the one to use them in a corner case where they fail." The reply was
largely "You can write bad code without macros. It's the programmer's

Arguments for:

"Macros allow me to say more clearly what I intend."

"Macros allow me to create a new language inside of Lisp. This is *so*
useful for writing "Domain Specific Languages." The reply here was to
go the whole way and write a compiler for the new language.

Then people starting throwing symbolic tomatoes and it got silly. At
one point, somebody said something in the debate about MIT using
Python instead of Scheme. It ended up with Gerry Sussman coming down
onto the floor and spending 5 minutes explaining how the nature of the
students and the general environment had so radically changed from the
Heyday of 6.001, that he let others deterime how intro would be taught.

But back to the debate! (er... riot?)

My contribution was the observation that as a Lisper, I had happily
written many a macro. But as a Java dude, I don't write them (uh, Java
doesn't *do* macros.) And I don't want them either! I do not see
anywhere in my code that I would use a macro. I'd rather type an extra
line than depend on an unknown transformation.

And I feel my code is far better now than it was then.

I got... uh... shouted down. The crowd was turning ugly.

10pm came, went, then "OMG! We have to be out of here 10 minutes ago!

There was no real conclusion. But it was good to talk about it.

[Next: Lightning Strikes!]

*Richard M Stallman
*Richard P Gaberial
*Guy L Steele
*Jon L White

(I know their logins names from 1980! This is sad...   :-)

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.