Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Modules Order
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] Modules Order
Warp wrote:

>
>The problem here is that we don't know if we're using either only types or
>functions from the other module.
>

One solution to that is to build interfaces containing types
with no corresponding implementation file. Then if you use
a name X for which there is an X.mli but no X.ml,
you're only using types.

This seems like a good policy in general, it is more robust,
since there is no need to keep a duplicated ml and mli file.

Ocaml's ability to process a .mli file with no corresponding
.ml file doesn't appear to be documented... it works for
the native code compiler, don't know about the bytecode
compiler.

If a type is only used locally, the requirement can be relaxed:
in such cases, by specification, some functions must be used
too, so the type can be included in the .ml and mli files.

BTW: the big pain here is functors: using ocamlc -i
to generate an expanded interface for a fuctor application
is really horrible and rarely works properly (you have to edit
the output to replace expanded definitions with aliases
to have any hope of reading it).

Is there a better way?

-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850




-------------------
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