separate compilation [was Re: Global variables?]

Andrew J Bromage ajb@spamcop.net
Thu, 6 Feb 2003 15:08:21 +1100


G'day all.

On Wed, Feb 05, 2003 at 09:28:05PM -0600, Jon Cast wrote:

> I think I see what you're saying.  I still maintain, however, that,
> since you've changed the type of B.b (admittedly implicitly), and B.b is
> exported from B, that you've changed B's interface.
> 
> There is a reason make is designed to re-build B /and/ (potentially) A
> when C changes, after all.

In principle, it shouldn't.  If module D imports module E, changing
E's implementation should not force a recompilation of module D
(assuming no intermodule optimisation, of course).  In GHC terms,
D.o should only depend on D.hs and E.hi.

However, this isn't my main problem.  This is at best a big pain,
and at worst a potential waste of an expensive software engineer's
time.  Software engineers like it when they can predict how long a
compilation will take.  The unknowns are an acceptible risk when
intermodule optimisation is turned on, but if I'm being paid by the
hour to hack Haskell code, I want a way to turn that off in order to
better schedule my day.  I digress.

My main problem is that under H98, it's not possible, in general, to
determine what the public interface of a module actually _is_ without
intermodule analysis.  This, IMO, breaks pretty much every sensible
meaning that you could assign to the term "separate compilation".

Cheers,
Andrew Bromage