Explanation of macros; Haskell macros

Joachim Durchholz joachim.durchholz at web.de
Thu Oct 30 10:29:47 EST 2003


Roman Belenov wrote:
> 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);

If that's the case, it's probably more due to lack of demand than due to 
serious technical issues.

 > 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  [code]

Agreed.

> and [quoting will lead to] less intuitive code.

Efficiency issues aside: how are macros more intuitive than quoting?

Regards,
Jo





More information about the Python-list mailing list