Re: separate compilation [was Re: Global variables?]

Andrew J Bromage
G'day all.
On Wed, Feb 05, 2003 at 04:16:33PM -0800, Iavor S. Diatchki wrote:
why do you think separate compilation is difficult to achieve in Haskell 98?
Because of type inference over recursive module imports. Determining the type of a function may, in general, require inferring types from an arbitrary number of other modules, and may require inference to occur at the level of granularity of a clique in the import graph, rather than at the level of a single module.
Requiring an implementation to perform static analysis a clique at a time is not "separate compilation", because changing something which is private to one module may in general require an unbounded number of other modules to be recompiled, even if inter-module optimisation is turned off.
I'm not sure I follow this. If you change the type of a value exported from a given module, that's a public change, no? And if you don't, why should re-compilation be needed? <snip>
Cheers, Andrew Bromage
Jon Cast

G'day all. On Wed, Feb 05, 2003 at 08:05:56PM -0600, Jon Cast wrote:
I'm not sure I follow this. If you change the type of a value exported from a given module, that's a public change, no? And if you don't, why should re-compilation be needed?
Consider this: << module A where import B {- use B.b -}
<< module B (b) where import C b = C.c
<< module C (c) where c :: Int
Changing the type of c requires recompiling module A. You would expect that changing c's type forces a recompilation of B, since you changed C's public interface. However, this also changes B's public interface even though you did not touch the text of module B. The reason is that B's public interface is partly based on modules which it _privately_ imports, even if it does not re-export any symbols from those modules. One fix is to require all exported symbols to have explicit type declarations. Since this is good practice anyway, I would be in favour of making it a language requirement in Haskell 2. Cheers, Andrew Bromage
participants (2)
-
Andrew J Bromage
-
Jon Cast