#ifdef considered harmful
ross at soi.city.ac.uk
Wed Apr 7 11:48:08 EDT 2004
On Wed, Apr 07, 2004 at 08:57:31AM +0100, Simon Peyton-Jones wrote:
> I agree with Johannes: (a) keep it simple, (b) integrate with compilers.
> (a) argues for cpp. As to (b) is there some reason that Hugs cannot
> simply run cpp?
Hugs has an option for preprocessing source files, but it's inefficient
because of the way Hugs handles imports. It's fine for experimental use,
but it's usually better to preprocess libraries on installation. (If we
had hspp, we could do that in Haskell too -- Sigbjorn has done a first
cut at it using system.)
Grisly details: Hugs reads a module, and if it contains imports it hasn't
read yet it abandons the current module and pushes it and the new modules
onto the stack of modules to be read. Simple, and fairly cheap if it's
reading a file, because it hasn't got far when it hits the imports.
But if you're preprocessing, you've already paid most of the price, and
you get to pay it again when Hugs is finally ready to read the module
More information about the Libraries