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 NAA18899; Sat, 22 Mar 2003 13:09:19 +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 NAA18460 for ; Sat, 22 Mar 2003 13:09:18 +0100 (MET) Received: from ep09.kernel.pl (ep09.kernel.pl [212.87.11.162]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h2MC9Hf14467 for ; Sat, 22 Mar 2003 13:09:17 +0100 (MET) Received: (qmail 28463 invoked by uid 566); 22 Mar 2003 12:09:13 -0000 Date: Sat, 22 Mar 2003 13:07:10 +0100 From: Michal Moskal To: "Jeffrey J. Cook" Cc: caml-list@inria.fr Subject: Re: [Caml-list] code duplication when abstracting using explicit signatures Message-ID: <20030322120710.GA16956@roke.freak> References: <20030320233234.GA17684@crhc.uiuc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030320233234.GA17684@crhc.uiuc.edu> User-Agent: Mutt/1.4.1i X-PGP-Fingerprint: CF89 1B14 11BE 1CC9 2CA3 7497 5E32 69B4 BC71 B4C2 X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Spam: no; 0.00; michal:01 moskal:01 malekith:01 pld-linux:01 caml-list:01 0600,:01 mli:01 ocamlopt:01 ocamlc:01 afair:01 wroclaw:01 cmo:01 ocaml:01 signatures:02 linking:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Mar 20, 2003 at 05:32:34PM -0600, Jeffrey J. Cook wrote: > I'm trying to avoid code duplication, but have a very simple case where it > seems inescapable utilitizing only the functionality of the ocaml tools. In > example.mli, I declare several large types, in which I want the full contents > of the types to be visible to other modules. How do I avoid duplicating those > full definitions in example.ml? I've tried using "include Example" at the > beginning of example.ml, which ocamlopt has no argument with, but ocamlc gives: > > Error while linking example.cmo: Reference to undefined global `Example' > > > I can't simply skip the .mli, as there are functions in example.ml that > I don't want exported; not to meantion the clean-ness of seperation .mli's > provide. Any suggestions? Use example_types.mli and example.ml/mli. AFAIR you can only put types in example_types, not even exceptions. -- : Michal Moskal ::::: malekith/at/pld-linux.org : GCS {C,UL}++++$ a? !tv : PLD Linux ::::::: Wroclaw University, CS Dept : {E-,w}-- {b++,e}>+++ h ------------------- 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