[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Macros
Dear all,
to re-heat the debate about macros, it seems to me that OF COURSE,
things done with macros could always be done without, with a proper
encoding of the problem into the current language. But this requires
knowing *in advance* the kind of treatment to be done to the code,
and to keep reified any meta-information that this treatment may entail:
if a further evolution in the meta-level processing needed reveals
that not enough was reified in the macro-less infrastructure, then
the whole program suddenly has to be rewritten, transformed, annotated,
so as to use a new meta-level functionality - an expensive global
reengineering effort, instead of a small incremental change to the program.
To allow for future evolution, more and more information has to be kept
reified, until the point where the whole program source is available to
be processed through hand-written code preprocessors and metaprograms,
at which point macros have been reinvented, except in a much cruder form
(see all those wonderful software to process C/C++/Java code).
All in all, the justification for macros and metaprogramming can be found
in the study of the incremental process of live software development, and
not in the study of the global static structure of dead completed software.
That's what I tried to explain in my 1999 article:
http://fare.tunes.org/articles/ll99/
I constantly develop macros and use software that relies on macros:
declarative construction of control structures (loop, series, Screamer,
pattern matchers), data structures (PCL, other object systems,
problem-specific defining forms), integrate code & documentation (literate
programming, Scribe, etc.), mostly orthogonal persistence (PLOB!), syntax
that follows the usual flow of thought rather than the computer flow of
control, domain-specific embedded little-languages (scsh), etc.
I can't imagine a decent programming without macros. Even OCaml has camlp4!
[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
[ TUNES project for a Free Reflective Computing System | http://tunes.org ]
You have the capacity to learn from mistakes. You'll learn a lot today.