#ifdef considered harmful

Simon Peyton-Jones simonpj at microsoft.com
Wed Apr 7 09:57:31 EDT 2004

I have not been following the details of this thread, but let me urge

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? 

| -----Original Message-----
| From: libraries-bounces at haskell.org
[mailto:libraries-bounces at haskell.org] On Behalf Of Johannes
| Waldmann
| Sent: 07 April 2004 07:43
| To: Alastair Reid
| Cc: libraries at haskell.org
| Subject: Re: #ifdef considered harmful
| Alastair Reid wrote:
| > So, I'd like to float the idea that the Haskell preprocessor should
| > 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,
| >    [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 at haskell.org
| http://www.haskell.org/mailman/listinfo/libraries

More information about the Libraries mailing list