Re: Python gets macros - now XML does too

From: Florian Weimer (fw_at_deneb.enyo.de)
Date: 01/05/05


Date: Wed, 05 Jan 2005 23:20:10 +0100


* Manuel Lemos:

> Unless I misunderstood anything about LISP macros, it is not even unique
> to LISP. C has support for macros via the preprocessor, C++ has template
> classes and Java now has generics.

The only thing that comes close to Lisp macros is C++ template
metaprogramming. However, template metaprogramming has the unwanted
property that it's radically different from the usual imperative
programming style, and there is virtually no debugging support (the
error messages from the compiler are abysmal, you can only test
template expansion by running the generated code).

Your other examples are mostly equivalent to text substitution and not
nearly as powerful. Java generics deliberately do not support partial
specialization in the way C++ does (and which opens the door to
template metaprogramming). The C preprocessor doesn't even provide
loops.