Explanation of macros; Haskell macros

Roman Belenov Roman.Belenov at intel.com
Thu Oct 30 11:09:42 EST 2003


Joachim Durchholz <joachim.durchholz at web.de> writes:

> IIRC even Lisp allows you to keep expressions unevaluated via
> quoting. So macros wouldn't be the only way to control evaluation:
> quote the expression and have the callee evaluate it at a convenient
> time.

The problem is that quoted form is just a piece of data from
compiler's point of view, so it is kept as is and has to be interpeted
in runtime (while code generated by macros is usually compiled
normally); besides, such forms can not access lexical variables in the
enclosing context (otherwise runtime environment would have to support
access to lexicals by name, which has performance implications and is
not necessary for normal compiled code). So, theoretically, you can
use quoting to control the order of evaluation, but practically it
will lead to very inefficient and less intuitive code.

-- 
 							With regards, Roman.

Standard disclaimer: I work for them, but I don't speak for them.




More information about the Python-list mailing list