Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-02-03 (20:44)
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 ) :

---- -----
include Types
include Funcs

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

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

And a test program :

---- -----
open Main
f (get_ta())

Let's compile :
ocamlc -c
ocamlc -c
ocamlc -a -o main.cma
ocamlc -c

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


Bug reports:  FAQ:
To unsubscribe, mail  Archives: