Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] Haskell features in O'Caml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christian.Schaller@c...
Subject: RE: [Caml-list] Haskell features in O'Caml
vanicat@labri.u-bordeaux.fr wrote:

> >   Since implementation is not automatically checked against 
> the interface
> > (or did I get something wrong?),
> 
> yes, you do:
> 
> test.ml :
> 
> let f x = x
> 
> test.mli :
> 
> val f : int -> float
> 
> $ ocamlc -c test.ml
> I/O error: test.cmi: No such file or directory
> $ ocamlc -c test.mli
> $ ocamlc -c test.ml
> The implementation test.ml does not match the interface test.cmi:
> Values do not match: val f : 'a -> 'a is not included in val 
> f : int -> float

oops, yes you're right.  I was trying it that way:
* create test.ml
* compile it => test.cm[io] file
* now create test.mli
* compile test.ml again
and no error message will be issued, since test.cmi is existing, though has
totally different signature.  This problem does also occur whenever the
interface is changing!  There seems to be no check if interface source is
newer than the compiled one (I'm using OCaml 3.02 @ cygwin without tk;
Win2k, English, SP2).

  It gets also interesting, when you are using -i to see the signature of
your definitions.  A correct test.mli will yield "val f : int -> int",
however compiling the definition will yield "val f : 'a -> 'a".

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