Explanation of macros; Haskell macros

Joachim Durchholz joachim.durchholz at web.de
Fri Oct 31 21:22:03 EST 2003


Lex Spoon wrote:

> Joachim Durchholz <joachim.durchholz at web.de> writes:
> 
>>This statement is wrong if left in full generality: higher-order
>>functions can control quite precisely what gets evaluated when. 
> 
> They don't let you execute stuff at compile time.

Ah, I didn't think of compile-time evaluation, I was thinking about 
evaluation stuff sooner or later at run-time.

And, of course, macros can evaluate at compile time.
Personally, I'd prefer to do compile-time evaluation based on "the 
compiler will evaluate all known-to-be-constant expressions". The 
advantage here is that programmers don't need to learn another 
sublanguage for compile-time expressions.

I haven't seen this done in full generality though, so I don't know how 
well this would work in practice.

Regards,
Jo





More information about the Python-list mailing list