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 LAA20089; Tue, 24 Aug 2004 11:09:24 +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 LAA18815 for ; Tue, 24 Aug 2004 11:09:23 +0200 (MET DST) Received: from [128.93.8.158] (macaque.inria.fr [128.93.8.158]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i7O99LmL016917; Tue, 24 Aug 2004 11:09:21 +0200 In-Reply-To: <16682.21287.26129.98212@soggy.deldotd.com> References: <16682.21287.26129.98212@soggy.deldotd.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <4D4C90B6-F5AD-11D8-B0E6-00039310CAE8@inria.fr> Content-Transfer-Encoding: 7bit Cc: caml-list@pauillac.inria.fr From: Damien Doligez Subject: [Caml-list] Re: Date: Tue, 24 Aug 2004 11:09:28 +0200 To: briand@aracnet.com X-Mailer: Apple Mail (2.619) X-Miltered: at nez-perce with ID 412B05C1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; damien:01 damien:01 const:01 const:01 mli:01 cmo:01 cmo:01 ocaml:01 ocaml:01 caml:01 caml:01 toplevel:01 doligez:01 doligez:01 float:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Aug 23, 2004, at 22:27, briand@aracnet.com wrote: > ~/src/ocaml/math $ ocaml > Objective Caml version 3.08.0 > > # #load "const.cmo";; > # Const.pi > ;; > - : float = 3.14159265358979312 > # > > > ~/src/ocaml/math $ cd .. > ~/src/ocaml $ cd pll > ~/src/ocaml/pll $ ocaml > Objective Caml version 3.08.0 > > # #load "../math/const.cmo";; > # Const.pi;; > Unbound value Const.pi > > Huh ?? What is the type of Const.pi? In order to answer this question, you have to know the interface of module Const. This interface lives in const.mli, which is compiled to const.cmi. It is automatically looked up in the current directory, but not in ../math (unless you use option -I). In other words, a module is composed of two things: its interface and its implementation. The interface is all you need to know at compile time, while the implementation is all you need at execution time. But the toplevel does both compilation and execution, so it needs both. The #load directive only provides the implementation. You should also add "../math" to the interface search path with the #directory directive: # #load "../math/const.cmo";; # #directory "../math";; # Const.pi;; -- Damien ------------------- 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