From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA19638; Mon, 19 Mar 2001 00:05:14 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA20287 for ; Mon, 19 Mar 2001 00:05:13 +0100 (MET) Received: from mta6.snfc21.pbi.net (mta6.snfc21.pbi.net [206.13.28.240]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f2IN5B120441 for ; Mon, 19 Mar 2001 00:05:12 +0100 (MET) Received: from checkerlap.d6.com ([64.160.53.129]) by mta6.snfc21.pbi.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0GAF007A81FUAE@mta6.snfc21.pbi.net> for caml-list@inria.fr; Sun, 18 Mar 2001 15:04:43 -0800 (PST) Date: Sun, 18 Mar 2001 15:05:41 -0800 From: Chris Hecker Subject: [Caml-list] recursive modules redux, & interface files X-Sender: def6@shell16.ba.best.com To: caml-list@inria.fr Message-id: <4.3.2.7.2.20010318142842.00d85300@shell16.ba.best.com> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Content-type: text/plain; charset="us-ascii" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Two questions/problems: 1. So, I understand that doing recursive types across modules is hard (but I'd say very important for decoupling large software), but is it true that I can't even call across modules recursively? Even with mli files to resolve the types? I find that incredibly hard to believe, but I can't get it to work and it seems the docs say it's impossible as well (so why am I posting about it, you ask? Disbelief that it's not possible, I guess. :). What is the point of separate mli files if they can't be used to declare a callable interface separate from the implementation? Is this just a small feature that needs to be added to the linker (defer binding unseen modules until all the object files have been seen), or is there something really subtle going on? Since everything compiles and type checks fine, and the subtleties that I don't understand in ocaml usually have to do with the type checker, I'm having trouble seeing how this could be that hard. Example below. Am I missing something? 2. Also, on a related note, why do the interface file and the implementation file (or equivalently, I believe, the signature and structure) both have to have all the concrete types duplicated? I can see the value of having interfaces that hide some implementation stuff and abstract types, but if I've got a big fully-specified variant type in a .mli file, it's annoying and error prone (yes, I know the compiler will catch it) to have to retype the whole thing into the ml file (which I have to do if I want to hide anything else in the ml file, meaning I can't just have an ml without an mli). Is this something the "include" keyword takes care of? Heck, "#include" would be an improvement over duplicating all the types. :) One of the things I hate about C++ and is having to type function declarations/definitions multiple times. Thanks, Chris --------- Example for Question 1: --- t1.mli --- val foo: int -> int --- t1.ml --- let foo x = if x = 1 then T2.bar x else x --- t2.mli --- val bar: int -> int --- t2.ml --- let bar x = if x = 2 then T1.foo (x-1) else x --- main.ml --- let _ = print_int (T2.bar 2) ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr