[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Macros Make Me Mad
I agree entirely with everything you said, too. (What a lovely place to
be.) Basically, macros cannot be trusted in the hands of people who
lack very strong skills, discipline or taste. I.e., you want them to
have all three before being trusted with creating macros.
While it would be wonderful to have a large team of such talented
individuals over a long period of time, it has been my experience that
groups tend, over time, towards mediocrity or worse no matter how good
they started out. Again, not a technical argument, but definitely an
observation that concerns me. For this reason, it makes perfect sense
for many---possibly most---projects to avoid them like the plague.
On the other hand, I happily acknowledge that a skilled team of
ambitious programmers racing against the competition would undoubtedly
benefit from macros.
From: Paul Graham [mailto:email@example.com]
Sent: Friday, November 15, 2002 4:07 PM
Subject: Re: Macros Make Me Mad
I agree entirely with your premises. Macros are language
constructs, and as such have to be held to higher standards.
I don't see how your conclusion follows from this-- that
macros will yield more problems than benefits.
What about all the stuff in Lisp that's already implemented
as macros, for example? Are you saying it's a lose to have
these operators? Probably not. So why is it bad to write more?
I think the root of your mistake is saying that macros
don't scale to larger groups. The real truth is that
macros don't scale to stupider groups. A group of one
idiot can easily render his code unreadable with badly
designed macros. Whereas a group of smart programmers,
however large, will be able to use macros in safe ways
that yield net wins. E.g. by doing bottom-up programming.
To adapt Mike Vanier's LFSP, macros are simply an FFSP.
Macros would only be bad if there were no programmers
S enough to use them safely. That one I can answer from
experience. I probably know 50 Lisp hackers personally
that I would trust to write macros.
Ergo macros are not a bad feature. At worst they are
a high-end niche feature. And that kind of feature is
in fact especially interesting to companies in competitive
situations, as I tried to show in Revenge of the Nerds.
--Todd Proebsting wrote:
> Despite the fact that many folks I respect swear by macros, I've yet
> feel comfortable with them in a language. Since LL2, I've been trying
> to figure out what my resistance is based on.
> Let me say that I think that macros are beautiful and powerful and all
> those good things. Let's not quibble about that.
> 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
> the documentation.
> I know precious few programmers who document well at all, much less to
> the level I expect in a language definition, and I know precious few
> programmers who implement and test their own code to the level
> in a compiler. Therefore, I'd expect more problems from macros than
> Are these technical reasons? No. But they are practical reasons, and
> ultimately I program practically. Macros may be great for individuals
> and small groups, but I just don't believe that they scale for these
> non-technical reasons.