Hygienic macros (was: do...until wisdom needed...)

Dave LeBlanc whisper at oz.net
Wed Apr 18 05:19:27 EDT 2001


Sounds so much like Tcl!

On 17 Apr 2001 20:59:52 -0400, Douglas Alan <nessus at mit.edu> wrote:

>Lisp has traditionally had "procedural macros".  Procedural macros in
>Lisp are a kind function -- they are implemented in Lisp, but the
>return value of the macro, rather than being returned as a function
>value, is taken to be a piece of code.  This is easier in Lisp than
>in most languages because Lisp code is a kind of Lisp data structure.
>The code that is returned by the macro call, which is executed at
>compile-time, is used to replace the original call to the macro.
>
>This allows a programmer to define new syntactic forms. These behave
>differently from normal function calls, since they can do things like
>rebind variables in the scope of the macro invocation, etc., and they
>avoid procedure call overhead, so they can be used to effectively
>force inlining.
>
>The problem with non-hygienic macros is that variable names used by the
>macro implementation can conflict with variable names that are passed
>into the macro.  Hygienic macros solve this problem by putting the
>variables in different namespaces.
>
>Hope this helps.
>
>|>oug




More information about the Python-list mailing list