Re: dependency analysis
Original-Via: uk.ac.nsf; Fri, 18 Oct 91 05:18:44 BST The question here is whether a particular way of dividing tasks should be supported by a particular language mechanism. There are good (but perhaps not conclusive) arguments in favor of support for recursive modules. But "some things are too large to fit into one module" isn't one of them. In theory it might not be a good argument, but if you are stuck with a compiler that simply chokes on big modules you have little alternative. (You are of course fee to write a new compiler, but that may take some time.) -- Lennart
Re: dependency analysis
Original-Via: uk.ac.ed.aiai; Thu, 17 Oct 91 16:12:59 BST Mutual recursion is a natural part of functional programming style, and we shouldn't have to come up with special examples to justify its existence. If it were equally natural in this case then I think the issue would never have arisen. The reason that the typechecker is written with mutually recursive modules is that it is more natural to manage it this way, and that stems directly from the fact that mutual recursion is used to write it. Not all that directly, since it's not the case that all mutually recursive procedures generate mutually recursive modules. Of course if you draw the module division between the procedures, you will have to have mutually recursive modules. We broke it into modules early on, before it grew so large that it couldn't possibly fit into one module. I thought the reasons you gave above were good ones, but now it looks like they might be based not on a natural division of functionality but, ultimately, on some notion of a maximum size for modules. Is there really some size that can't _possibly_ fit into one module?
Re: dependency analysis
Original-Via: uk.ac.st-and.cs; Tue, 15 Oct 91 14:54:37 BST Tony Davie's remarks prompt me to ask: "Who needs mutually recursive modules anyway?". I've never missed the facility in Miranda and my programs are much the clearer for it --- module dependency diagrams with NO directed cycles --- bliss! Our Haskell in Haskell compiler modules are often unavoidably mutually recursive. For small programs you may be right, but for large programs mutually recursive modules are almost inevitable: i) There's always some implementation limit on module size, even with a C compiler... ii) Readability or the need for separate working may demand that a large module be broken into parts. Don't functional programmers write large programs? :-) :-) Kevin The Haskell Committee for one, judging from the comments in section 5.4.1 of the report, stating that Prelude and PreludeCore are mutually recursive! Mark Yes: I think recursive modules are probably needed. BUT maybe a reasonable restriction would be not to allow dependency cycles which cut across module boundaries. I would like to know if any of Kevin's recursive module structures contain mutually recursive objects in different modules.
Re: dependency analysis
Original-Via: uk.ac.nsf; Tue, 15 Oct 91 14:44:45 BST Tony Davie's remarks prompt me to ask: "Who needs mutually recursive modules anyway?". I've never missed the facility in Miranda and my programs are much the clearer for it --- module dependency diagrams with NO directed cycles --- bliss! I expect there is some pressing (and obvious) reason why mutual recursion is a must in Haskell --- could someone enlighten me ? Ian Poole Take the machine code generator in the LML compiler as an example. It consists of several thousands of lines of LML. Logically it is really only one module, But it is necessary (and indeed desirable) to split this up in smaller units, to be able to compile it at all. -- Thomas Johnsson