Explanation of macros; Haskell macros

Joachim Durchholz joachim.durchholz at web.de
Thu Oct 30 08:56:17 EST 2003


Alain Picard wrote:
> Joachim Durchholz <joachim.durchholz at web.de> writes:
>>Alain Picard wrote:
>>>More precisely: "macros make control of when, if, and how often,
>>>                 something is evaluated _possible_."  Functions
>>>(your only other option) give you no choice.
>>
>>This statement is wrong if left in full generality: higher-order
>>functions can control quite precisely what gets evaluated when. If the
>>language offers both lazy and strict parameters, evaluation time
>>control extends to the parameter expressions as well.
> 
> My apologies to the functional guys.  I was responding from a lisp
> newsgroup:

Ah, the joys of inadvertent crossposting ;-)

 > so let me amend the above to end with "IN LISP".

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.

 > [We do not have lazy evaluation by default.]

The default evaluation strategy doesn't change too much; all you need is 
some way of deferred evaluation. It need not even be laziness, having a 
meta level (such as quoting) or access to the compiler can be used.

As I said, it's still different from macros.

Regards,
Jo





More information about the Python-list mailing list