[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macros Make Me Mad

Todd: Interesting note. Actually I don't know whether documentation or
expecting programmers to test their code necessarily affects

I do agree w/ your conclusion that macros don't scale (I presume you
mean 'scalability to large/fluid teams over long periods of time') but
for somewhat different reasons.

Personally speaking, and I speak from the perspective of someone who
has seen a lot of "good" vs. "bad" macrology (esp. in Lisp), the
disadvantages of macros are really wrt. 
     - tool support (It's always a pain when you have to meta-sh-m and 
       stare at tens of pages of code -- each layer has a reason, but
       sometimes you need to see/debug them all together, and I've
       never been happy with the current crops of tools, in terms of
       setting breakpoints, doing partial expands in the editor etc.)
     - arbitrariness in how macros tend to get re-used (at least w/ OO
       programming, we have developed idioms and use those to read other
       people's code.. macros tend to far more loosey-goosey and over
       time tend to develop a lot more warts -- a couple of keywords
       here, and a couple of re-writes there, and pretty soon you have
       a godawful mess where even the best programmers fear to (t)read).

But these limits on scalability must be balanced against the fact that
you can do so much more "with" macros -- i.e. you don't need
tens/hundreds of programmers -- all you need is a couple smart ones
whose mental maps you are in sync with. :)

> Todd Proebsting :
> Despite the fact that many folks I respect swear by macros, I've yet to
> 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 trust
> 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 expected
> in a compiler.  Therefore, I'd expect more problems from macros than
> benefits.
> 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.
> Todd