Version française
Home     About     Download     Resources     Contact us    
Browse thread
Type-checking bug (or feature?) in O'Caml 1.06
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Paul Stodghill <stodghil@c...>
Subject: Type-checking bug (or feature?) in O'Caml 1.06
[ Pardon, mais non français. ]

Something changed in the way that type checking is done between 1.05 and
1.06. Bug or feature?

% ~pidgin/sww/sparc-solaris/bin/ocamlc -v
The Objective Caml compiler, version 1.05
Standard library directory: /usr/u/pidgin/sww/sun4-solaris/lib/ocaml
% ~pidgin/sww/sparc-solaris/bin/ocamlc -c caml_map.mli
% ~pidgin/sww/sparc-solaris/bin/ocamlc -c caml_map.ml

% ~/usr/sparc-solaris/bin/ocamlc -v
The Objective Caml compiler, version 1.06
Standard library directory: /home/stodghil/usr/sparc-solaris/lib/ocaml
% ~/usr/sparc-solaris/bin/ocamlc -c caml_map.mli
% ~/usr/sparc-solaris/bin/ocamlc -c caml_map.ml
The implementation caml_map.ml does not match the interface caml_map.cmi:
Values do not match:
  val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit
is not included in
  val iter : ('a -> 'b -> 'c) -> ('a, 'b) t -> unit

Below are the relevant parts of the code that is causing the problem.
This code is taken directly from the compatibility library generated by
caml2cslV2.0.

>From caml_map.mli:
---------------------------------------------------------------------------
val iter: ('a -> 'b -> 'c) -> ('a, 'b) t -> unit
---------------------------------------------------------------------------

>From caml_map.ml:
---------------------------------------------------------------------------
let iter f m =
  let rec iter = function
    Empty -> ()
  | Node(l, b, r, _) ->
      iter l;
      f b.key b.data;
      List.iter (f b.key) b.prev;
      iter r
  in iter m.tree;;
---------------------------------------------------------------------------

-- 
Paul Stodghill <stodghil@cs.cornell.edu>
http://www.cs.cornell.edu/home/stodghil/home.html