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 OAA31032; Sat, 12 Oct 2002 14:43:07 +0200 (MET DST) 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 OAA31209 for ; Sat, 12 Oct 2002 14:43:06 +0200 (MET DST) Received: from mel-rto6.wanadoo.fr (smtp-out-6.wanadoo.fr [193.252.19.25]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9CCh5527553 for ; Sat, 12 Oct 2002 14:43:05 +0200 (MET DST) Received: from mel-rta10.wanadoo.fr (193.252.19.193) by mel-rto6.wanadoo.fr (6.5.007) id 3DA24D4D0030780E; Sat, 12 Oct 2002 14:43:03 +0200 Received: from iliana (80.11.160.38) by mel-rta10.wanadoo.fr (6.5.007) id 3DA24C0A0031B36D; Sat, 12 Oct 2002 14:43:03 +0200 Received: from luther by iliana with local (Exim 3.36 #1 (Debian)) id 180LlA-0000gN-00; Sat, 12 Oct 2002 14:52:48 +0200 Date: Sat, 12 Oct 2002 14:52:48 +0200 To: Yang Shouxun Cc: caml-list@inria.fr Subject: Re: [Caml-list] automatic extraction of mli file? Message-ID: <20021012125248.GA2598@iliana> References: <3DA8021B.3050102@fltrp.com> <005701c271e3$30eb3130$55203151@warp> <3DA80C9F.1050401@fltrp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3DA80C9F.1050401@fltrp.com> User-Agent: Mutt/1.4i From: Sven LUTHER Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, Oct 12, 2002 at 07:50:55PM +0800, Yang Shouxun wrote: > Nicolas Cannasse wrote: > >>What I'm wondering is "wouldn't it be preferrable to automatically > >>produce the interface file from the implementation file?", so that we > >>can program in the literate programming style, do prototyping, and save > >>the drudgery of writing the interface (though a little manual editing > >>may be necessary, or some kind of markup in the source code). > > >The "-i" ocamlc compiler flag is what you need. > > This seems to be not what I mean. OK, that is what I asked :(. > > All the comments will be removed. That is not desirable, for the mli > file is meant to be read by both machine and humans. The humans need the > comments to make sense of the interface file, without reference to the > implementation code. Well, in general, you write the .ml, and once you are satisfied, you can generate the .mli, and adapt it to your need : add comments, remove uneeded info, etc. Later one, you have to maintain both files separatedly. The idea being that the .mli is the contract that the .ml has with its users, so basically you can improve on the .ml, without changing much its interface. Another way of programming, is writting the .mli first, so it correspond to what you want, and then write the implementation of it. But any way you do it, normally you don't change the .mli very much after the first writing, so it is ok to maintain it by hand. Friendly, Sven Luther ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners