[EMAIL PROTECTED] (S.D.Mechveliani) writes:

> Only why the ghc implementors keep on saying the mutually recursive 
> modules is a headache? 
> The bold-naive question arises:
> if ghc compiles, - without warning and without asking the order of 
> compilation, - the mutually recursive functions f, g, why cannot it
> do this "similarly" for the modules M, N ?

The problem is trying to sensibly combine the idea of separate
compilation with inter-module recursion: we use separate compilation
for two reasons:

        * abstraction
        * efficiency (incremental compilation)

One way to deal with mutually-recursive modules is to compile all the
modules in a group simultaneously.  However, this rather defeats the
efficiency argument: you might as well just put all the code in one
module.

Another approach is to have the *programmer* declare explicit types
for functions and data involved in the inter-module recursion.  This
is the approach GHC uses - you can write an explicit .hi-boot file.
The reason this is a pain is because .hi-boot files are intended for
automatic generation and the syntax isn't particularly nice, and also
because identifying the minimum amount of information needed to get
the process bootstrapped can be quite tiresome.

In the past, people have discussed better ways to do this - eg. have
the compiler look in the source for the declarations to use.  I don't
think there are any implementations yet, though.

Cheers,
        Simon

-- 
Simon Marlow                                             [EMAIL PROTECTED]
University of Glasgow                       http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key

Reply via email to