* [Caml-list] Why not 'include' in an .mli file?
@ 2004-04-14 16:41 Richard Jones
2004-04-14 16:52 ` Markus Mottl
0 siblings, 1 reply; 3+ messages in thread
From: Richard Jones @ 2004-04-14 16:41 UTC (permalink / raw)
To: caml-list
I have a library which for various reasons is split into two modules,
called them Analysis_p and Analysis.
I want end-user programs to be able to 'open Analysis', and get all
the symbols from both modules. This is simple enough using the
'include' directive:
analysis.ml: include Analysis_p
(* plus a few extra functions *)
However when I added an analysis.mli file, I found that I could not
automatically 'include' symbols from Analysis_p. The following
doesn't work:
analysis.mli: include Analysis_p
(* plus a few extra prototypes *)
ocamlc -w s -g -I +pcre -I +postgres -I +dbi -c analysis.mli
File "analysis.mli", line 1, characters 8-24:
Unbound module type Analysis_p
Instead it seems, as far as I can see, that I have to list out all the
prototypes again in analysis.mli. Is this so? If so, it's a pain for
me, and means that prototypes for one function exist in two different
places (also I don't control Analysis_p directly, so it requires extra
coordination).
Rich.
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles,
RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Why not 'include' in an .mli file?
2004-04-14 16:41 [Caml-list] Why not 'include' in an .mli file? Richard Jones
@ 2004-04-14 16:52 ` Markus Mottl
2004-04-15 19:43 ` Christopher Quinn
0 siblings, 1 reply; 3+ messages in thread
From: Markus Mottl @ 2004-04-14 16:52 UTC (permalink / raw)
To: Richard Jones; +Cc: caml-list
On Wed, 14 Apr 2004, Richard Jones wrote:
> However when I added an analysis.mli file, I found that I could not
> automatically 'include' symbols from Analysis_p. The following
> doesn't work:
>
> analysis.mli: include Analysis_p
> (* plus a few extra prototypes *)
>
> ocamlc -w s -g -I +pcre -I +postgres -I +dbi -c analysis.mli
> File "analysis.mli", line 1, characters 8-24:
> Unbound module type Analysis_p
Note that this is a module type, not a module. You could put the
module type (interface) of "Analysis_p" into the submodule "S" of the
extra-file "analysis_p_intf.mli". Use it then to restrict the interface
of "Analysis_p" in "analysis_p.mli", and include it in "analysis.mli"
using "include Analysis_p_intf.S".
Regards,
Markus
--
Markus Mottl http://www.oefai.at/~markus markus@oefai.at
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Why not 'include' in an .mli file?
2004-04-14 16:52 ` Markus Mottl
@ 2004-04-15 19:43 ` Christopher Quinn
0 siblings, 0 replies; 3+ messages in thread
From: Christopher Quinn @ 2004-04-15 19:43 UTC (permalink / raw)
Cc: caml-list
it strikes me that a cmi file can be thought of as comprising a module
type, and the compiler might be extended to allow for Richard's usage,
which imho is a natural one.
i believe this is in the wish list db from way back and not dismissed
or otherwise classified.
chris
>
> Note that this is a module type, not a module. You could put the
> module type (interface) of "Analysis_p" into the submodule "S" of the
> extra-file "analysis_p_intf.mli". Use it then to restrict the interface
> of "Analysis_p" in "analysis_p.mli", and include it in "analysis.mli"
> using "include Analysis_p_intf.S".
>
> Regards,
> Markus
>
--
thanks.
- chris
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-04-15 19:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-14 16:41 [Caml-list] Why not 'include' in an .mli file? Richard Jones
2004-04-14 16:52 ` Markus Mottl
2004-04-15 19:43 ` Christopher Quinn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox