
I have not been following the details of this thread, but let me urge caution. Cpp is used in mostly-trivial ways to deal with the fact that a single blob of source code is being fed into several different compilers. The fact that cpp is not perfect for this use is not a reason to design something new. cpp is readily available everywhere, whereas some new tool would not be. It certainly seems overkill to design a whole new pre-processor system! (Mind you, doing so might be an interesting exercise in its own right -- Template Haskell is such an experiment -- but the need here is for a solution, not a research programme.) 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? Simon | -----Original Message----- | From: libraries-bounces@haskell.org [mailto:libraries-bounces@haskell.org] On Behalf Of Johannes | Waldmann | Sent: 07 April 2004 07:43 | To: Alastair Reid | Cc: libraries@haskell.org | Subject: Re: #ifdef considered harmful | | Alastair Reid wrote: | | > So, I'd like to float the idea that the Haskell preprocessor should _only_ | > support conditional compilation, that macro expansion should only occur in | > lines that begin with '#' not in "normal" lines and that macros should always | > evaluate to expressions with simple scalar types (ints, strings, etc.) | | > [It's probably simple enough that the preprocessor could | > easily be built into Hugs if we wanted. This isn't the primary | > motivation for this suggestion but it would be nice.] | | I'd vote for that (as a user). If we absolutely need preprocessing, | then the above looks like a very reasonable way to go: | 1. keep it simple, 2. integrate it with compilers. | | best regards, | -- | -- Johannes Waldmann, Tel/Fax: (0341) 3076 6479 / 6480 -- | ------ http://www.imn.htwk-leipzig.de/~waldmann/ --------- | | _______________________________________________ | Libraries mailing list | Libraries@haskell.org | http://www.haskell.org/mailman/listinfo/libraries

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 for real.
participants (2)
-
Ross Paterson
-
Simon Peyton-Jones