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 RAA05342; Fri, 6 Jun 2003 17:16:12 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA05311 for ; Fri, 6 Jun 2003 17:16:11 +0200 (MET DST) Received: from epexch01.qlogic.org ([63.170.40.3]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h56FGAT18968 for ; Fri, 6 Jun 2003 17:16:10 +0200 (MET DST) Received: from epmailtmp.qlogic.org ([10.20.33.254]) by epexch01.qlogic.org with Microsoft SMTPSVC(5.0.2195.5329); Fri, 6 Jun 2003 10:17:31 -0500 Received: from [10.20.33.146] ([10.20.33.146]) by epmailtmp.qlogic.org with Microsoft SMTPSVC(5.0.2195.4905); Fri, 6 Jun 2003 10:17:31 -0500 Date: Fri, 6 Jun 2003 10:33:25 -0500 (CDT) From: Brian Hurt X-X-Sender: Reply-To: Brian Hurt To: Stefan Heimann cc: Subject: Re: [Caml-list] Automatic generation of mli files In-Reply-To: <20030606095723.GA8096@kunz.ratzer> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 06 Jun 2003 15:17:31.0019 (UTC) FILETIME=[BF931DB0:01C32C3E] X-Spam: no; 0.00; qlogic:01 caml-list:01 mli:01 ocamlc:01 foo:01 compiler:01 writting:01 match:02 external:03 wrote:03 interface:03 fire:96 exported:03 abstract:03 types:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 6 Jun 2003, Stefan Heimann wrote: > Hi, > > I searching for a way for generating the .mli file for a given source .ml > file automatically. My basic idea is like that: > > (1) Specify in the .ml file which values and types should be exported > and if a type should be exported abstract or not. This could be > done with a special comment at the top of the file. > > (2) Filter the output of `ocamlc -i' to exclude the values and types > that should not be exported and to make the types abstract if > needed. Not sure what advantage this would gain. Step #1 is about as difficult as simply writting the .mli file directly. Actually, a fairly fast way to produce an mli file is to do ocamlc -i foo.ml > foo.mli and fire up your local text editor and delete everything out of foo.mli you don't want exported. I don't have a problem with .mli files being seperate from .ml files for two reasons: 1) .mli is your external interface- changing that interface generally means changing other files as well. In this case, you're generally already chaging other files. 2) The compiler checks the signature of the .mli file against what is produced by the .ml file, so if you do "accidentally" change an exported function's interface, and forget to change the .mli to match, the compiler will catch it. Brian ------------------- 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