On Sat, Jan 12, 2008 at 12:26:07AM -0800, SJS wrote:
So in a sense "macros" (or at least self modifying code) even predates
Fortran and Lisp!
A macro system is VERY useful when writing assembly.
But we need to be clear that macros are something completely different than
self modifying code.
General macros are code that runs at compile time. With assembly, the
macros are invoked during the run of the assembler.
Since lisp compiles incrementally, this can be a little unclear. The macro
is never modifying existing code. It takes a piece of uncompiled code and
modifies it before the final compiler ever sees it.
This is again, also very different from 'eval'.
An easy way to distinguish these is to think of how a cross compiler would
work. If I had a lisp cross compiler, any functions that are invoked as
part of a macro would have to be compiled or interpreted on the host. The
resulting code would then be compiled for the target system.
Having something like 'eval' allows you to get the same effect as could be
done with self-modifying code, but with a lot more safety, since the
compiler/interpreter is helping you. Macros won't help you modify the code
that is running.
Dave
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg