<span class="gmail_quote"></span><span class="q">On 8/20/06, <b class="gmail_sendername">Brian Hulley</b> &lt;<a href="mailto:brianh@metamilk.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">brianh@metamilk.com
</a>&gt; wrote:</span><div><div></div><div><span class="q"><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Henning Thielemann wrote:<br>&gt; On Thu, 17 Aug 2006, Brian Smith wrote:<br>&gt;<br>&gt;&gt; I find it strange that right now almost every Haskell program<br>&gt;&gt; directly or indirectly (through FPTOOLS) depends on CPP, yet there
<br>&gt;&gt; is no effort to replace CPP with something better or standardize its<br>&gt;&gt; usage in Haskell.<br>&gt;<br>&gt; I think there should be more effort to avoid CPP completely.<br><br>I agree, especially as I'm trying to write an editor for Haskell which will
<br>certainly not cope with CPP at all! ;-)</blockquote></span></div><div><div><br>I agree with this sentiment. But, CPP also has some advantages over the other suggestions presented here. Using CPP, we can create libraries that work with GHC 
5.x and old
versions of Hugs. If an alternative to CPP were chosen, would we update
fptools to use this alternative? If it involves new syntax, then updating FPTOOLS to use the new syntax would break backward compatibility. And, if (the vast majority of) FPTOOLS does not use the solution then it is not useful.
<br><br></div></div><div><span class="q"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The reason it would not cope is that CPP turns what would otherwise be one
<br>program/module/library into several programs/modules/libraries which<br>simultaneously co-exist in the same text in a rather uneasy and vague<br>relationship, and what's even worse: the same module can have multiple<br>

meanings in the *same* program depending on use of #ifdef #undef etc, thus<br>making code navigation quite impossible: the meaning of each module now<br>depends on how you got there and might even be different the second time
<br>round...</blockquote></span></div><div><div><br>Notice that with my suggestions none of these problems apply, because all external &quot;command line&quot; parameters have a single static value over the whole program (two modules cannot depend on differing values of a single macro, #undef is not allowed). Changing the bindings for these macros would invalidate any cached information the editor has. But, the editor has to support updating its caches anyway, to deal with switching libraries in/out, etc.
<br></div><br>I won't use an IDE effectively if it can't handle the libraries in FPTOOLS, which liberally use the preprocessor. Either the IDE has to handle the preprocessor or the libraries have to stop using them, or they have to meet somewhere in the middle. 
</div><div><span class="q"><br><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I think the acid test would be to reach a point where anyone can download
<br>the source for some large program such as GHC and just type ghc --make Main
<br>and expect the program to be built in one pass with no problems.</blockquote></span></div><div><div><br>I agree with this sentiment as well. Most of the little data processing programs I have written are built exactly like that already. How can we get the existing libraries to build like that though?
<br><br>- Brian<br><br><br></div></div>

</div>