caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Strange behavior
@ 2002-02-03 11:14 Warp
  0 siblings, 0 replies; only message in thread
From: Warp @ 2002-02-03 11:14 UTC (permalink / raw)
  To: OCaml

Here's a very short sample of a very strange behavior with CMA. I don't know
if it's a "bug" but it looks like...
I got a CMA ( let's call it Main ) :

---- Main.ml -----
include Types
include Funcs

---- Types.ml -----
type ta
type tb = ta
external get_ta : unit -> ta = "get"

---- Funcs.ml ----
open Types
external f : tb -> unit = "function"

And a test program :

---- Test.ml -----
open Main
f (get_ta())

Let's compile :
ocamlc -c types.ml
ocamlc -c funcs.ml
ocamlc -a main.ml -o main.cma
ocamlc -c test.ml

It works !
Now, we doesn't need anymore the CMI / CMO of Types and Funcs ( because all
defs are included in main.cma+cmi ), so let's delete theses files  :
rm types.c*
rm funcs.c*

... and try to compile Test :
ocamlc -c test.ml
This expression has type Main.ta = Types.ta but is here used with Types.tb

In fact, we need to keep the Types.cmi to compile, breaking the CMA rules. I
think this behavior comes from the "include" directive, which is
conservative with type paths.

Warp

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-02-03 20:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-03 11:14 [Caml-list] Strange behavior Warp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).