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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Warp <warplayer@f...>
Subject: [Caml-list] Strange behavior
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