From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 5640DBC37 for ; Thu, 12 Nov 2009 13:41:47 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuABAKSR+0rRVdrkimdsb2JhbACCITCNV4QjhxA/AQEBCgkMBxEFsEUBBY8KAQaEPIFwhjs X-IronPort-AV: E=Sophos;i="4.44,727,1249250400"; d="scan'208";a="37972378" Received: from mail-bw0-f228.google.com ([209.85.218.228]) by mail3-smtp-sop.national.inria.fr with ESMTP; 12 Nov 2009 13:41:46 +0100 Received: by bwz28 with SMTP id 28so2383759bwz.17 for ; Thu, 12 Nov 2009 04:41:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=SOlvYBBoAUmXmjm+n5sVcDS2On7uj5pqR4bwZ8KnrYY=; b=VHu+yVtRDyjARx1YnLaqs3qCEE7DBogujYMOYR2zxVg6sljDURGcuQ0oPZt+94NYCB ufOUY0ySTSEi1XZ0RoxXP3Mlt2Ins3T7v3ZS8YgMPwGhPvTV3P8+igUU3iX3CpMzIbNo GhFxP2tlzDhKi0DtRN2P3JZ5pZft/Om5r/uLc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=AiwCXOBmQ4VDo7Tk3M90MkZlDZ2+X50Ay+RpqN0JYivkbMOVVHWz40Ef/ZRq4Jje/I +u4vm6EBo/1+7Q/tz9E6xKPubLYXPJUPrgarFm44KnI8wHQ2YfPUjmTbjEZ/eaNYuIkK MtJ62r3Rv4atvF9R1xuxNlnAiE3EByTFIHHx0= MIME-Version: 1.0 Received: by 10.103.80.36 with SMTP id h36mr1026297mul.18.1258029705140; Thu, 12 Nov 2009 04:41:45 -0800 (PST) In-Reply-To: <4AFBFC9E.8010802@citycable.ch> References: <4AFBFC9E.8010802@citycable.ch> Date: Thu, 12 Nov 2009 13:41:45 +0100 Message-ID: <721f7f5a0911120441q6f41d36bhf794d32966f57522@mail.gmail.com> Subject: Re: [Caml-list] Including code from a .cm[ox] into another .cm[ox] From: Philippe Veber To: guillaume.yziquel@citycable.ch Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=0016e65b6176b1192d04782bdd53 X-Spam: no; 0.00; findlib:01 pxp:01 topfind:01 findlib:01 camlp:01 camlp:01 syntax:01 syntax:01 topfind:01 pxp:01 usr:01 lib:01 lib:01 ocaml:01 pcre:01 --0016e65b6176b1192d04782bdd53 Content-Type: text/plain; charset=ISO-8859-1 Hi maybe you can have a look at findlib and its #require statement. For instance, pxp (xml related library) depends on many cma, but everything loads automagically when invoking #require : Objective Caml version 3.11.1 # #use "topfind";; - : unit = () Findlib has been successfully loaded. Additional directives: #require "package";; to load a package #list;; to list the available packages #camlp4o;; to load camlp4 (standard syntax) #camlp4r;; to load camlp4 (revised syntax) #predicates "p,q,...";; to set these predicates Topfind.reset();; to force that packages will be reloaded #thread;; to enable threads - : unit = () # #require "pxp";; /home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pcre: added to search path /home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pcre/pcre.cma: loaded /home/pveber/usr/lib/godi/lib/ocaml/std-lib/unix.cma: loaded /home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/netsys: added to search path /home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/netsys/netsys.cma: loaded /home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/netstring: added to search path [...] /home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pxp-ulex-utf8/pxp_ulex_link_utf8.cmo: loaded /home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pxp: added to search path # Pxp_document.liquefy;; - : ?omit_end:bool -> ?omit_positions:bool -> (< clone : 'a; node : 'a Pxp_document.node; set_node : 'a Pxp_document.node -> unit; .. > as 'a) Pxp_document.solid_xml -> 'b -> Pxp_types.event option = hth, ph. 2009/11/12 Guillaume Yziquel > Hello. > > Imagine I have a file named a.ml containing > > module C = struct >> include B >> end >> > > and a file named b.ml containing the code > > let f x = x + 1 >> > > When I compile everything to .cmo files, I cannot load a.cmo from the > toplevel without loading b.cmo beforehand. > > Is there a way to make the 'include B' statement to include the code of the > B module in the C submodule directly so that it is not required to load the > b.cmo file before loading the a.cmo file? > > That would be extremely useful to me... > > All the best, > > -- > Guillaume Yziquel > http://yziquel.homelinux.org/ > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --0016e65b6176b1192d04782bdd53 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi

maybe you can have a look at findlib and its #require statement. For instance, pxp (xml related library) depends on many cma, but everything loads automagically when invoking #require :


=A0= =A0=A0=A0=A0=A0=A0 Objective Caml version 3.11.1

# #use "topfind";;
- : unit =3D ()
Findlib has been suc= cessfully loaded. Additional directives:
=A0 #require "package"= ;;;=A0=A0=A0=A0=A0 to load a package
=A0 #list;;=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to list the available packages
=A0 #camlp4o;;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to load camlp4 = (standard syntax)
=A0 #camlp4r;;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 to load camlp4 (revised syntax)
=A0 #predicates "p,q,...&quo= t;;;=A0=A0 to set these predicates
=A0 Topfind.reset();;=A0=A0=A0=A0=A0= =A0=A0=A0 to force that packages will be reloaded
=A0 #thread;;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 to enable thr= eads

- : unit =3D ()
# #require "pxp";;
/home/pveber= /usr/lib/godi/lib/ocaml/pkg-lib/pcre: added to search path
/home/pveber/= usr/lib/godi/lib/ocaml/pkg-lib/pcre/pcre.cma: loaded
/home/pveber/usr/lib/godi/lib/ocaml/std-lib/unix.cma: loaded
/home/pvebe= r/usr/lib/godi/lib/ocaml/pkg-lib/netsys: added to search path
/home/pveb= er/usr/lib/godi/lib/ocaml/pkg-lib/netsys/netsys.cma: loaded
/home/pveber= /usr/lib/godi/lib/ocaml/pkg-lib/netstring: added to search path
[...]
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pxp-ulex-utf8/pxp_ulex= _link_utf8.cmo: loaded
/home/pveber/usr/lib/godi/lib/ocaml/pkg-lib/pxp: = added to search path
# Pxp_document.liquefy;;
- : ?omit_end:bool ->= ;
=A0=A0=A0 ?omit_positions:bool ->
=A0=A0=A0 (< clone : 'a; nod= e : 'a Pxp_document.node;
=A0=A0=A0=A0=A0=A0 set_node : 'a Pxp_d= ocument.node -> unit; .. >
=A0=A0=A0=A0 as 'a)
=A0=A0=A0 Px= p_document.solid_xml -> 'b -> Pxp_types.event option
=3D <fun>

hth,
ph.


20= 09/11/12 Guillaume Yziquel <guillaume.yziquel@citycable.ch>
Hello.

Imagine I have a file named a.ml<= /a> containing

module C =3D struct
=A0include B
end

and a file named
b.ml contain= ing the code

let f x =3D x + 1

When I compile everything to .cmo files, I cannot load a.cmo from the tople= vel without loading b.cmo beforehand.

Is there a way to make the 'include B' statement to include the cod= e of the B module in the C submodule directly so that it is not required to= load the b.cmo file before loading the a.cmo file?

That would be extremely useful to me...

All the best,

--
=A0 =A0 Guillaume Yziquel
http://yziquel.= homelinux.org/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--0016e65b6176b1192d04782bdd53--