Macros

Ronny Wichers Schreur ronny@cs.kun.nl
Mon, 07 May 2001 11:14:22 +0200


Marcin 'Qrczak' Kowalczyk schrijft:

>I think [Clean macros] roughly correspond to inline functions
>in Haskell.

That's right. I think the most important difference is that Clean
macros can also be used in patterns (if they don't have a lower
case name or contain local functions).

The INLINE pragma for GHC is advisory, macros in Clean will always
be substituted.

>They are separate in Clean because module interfaces are written
>by hand, so the user can include something to be expanded inline
>in other modules by making it a macro.

>In Haskell module interfaces are generated by the compiler, so
>they can contain unfoldings of functions worth inlining without
>explicit distinguishing in the source.

Fergus Henderson replies:

>I don't think that Clean's module syntax is the reason. (Or if it
>is the reason, then it is not a _good_ reason.) [...]

You're right, having hand written interfaces doesn't preclude
compiler written interfaces (or optimisation files). Let's call it
a pragmatic reason: Clean macros are there because we don't do any
cross-module optimisations and we do want some form of inlining.



Cheers,

Ronny Wichers Schreur