Help --- type checker and I agree to disagree...

From: Steve Stevenson (steve@cs.clemson.edu)
Date: Fri Sep 24 1999 - 15:08:58 MET DST


From: Steve Stevenson <steve@cs.clemson.edu>
Date: Fri, 24 Sep 1999 09:08:58 -0400 (EDT)
To: caml-list@inria.fr
Subject: Help --- type checker and I agree to disagree...

I'm still experimenting with the deque I wrote about some time
ago. Now the type checker and I can't come to an agreement in one
module which we agree on the exact same construct somewhere else.
What am I not seeing?

Best regards,

steve
-----
Steve (really "D. E.") Stevenson Assoc Prof
Department of Computer Science, Clemson, (864)656-5880.mabell
Support V&V mailing list: ivandv@cs.clemson.edu
------------------------------------------------------------
The code:

open Objdeque
(* See below *)
open Rtnppxsem
(* Has type definitions for (NoOp,Nil) *)

let definemacro c_inp = c_inp#hpop
  
let gpm c_inp =
  let nulltype = ((NoOp,Nil):semantics) in
  let h_out = new objdeque nulltype in
  while true do
    let a = c_inp#hpop in
      match a with
      | (Definiendum, Nil) -> (definemacro c_inp); ()
      | _ -> (h_out#tpush a); ()
    done;
  h_out
------------------------------------------------------------
The disagreement
(merlin)[ORTN] 49) ocamlc -c test.ml
File "test.ml", line 8, characters 27-35:
This expression has type
  Rtnppxsem.semantics = Rtnppxsem.action * Rtnppxsem.semantics_data
but is here used with type 'a Objdnode.objdnode option as 'a
(merlin)[ORTN] 50)
------------------------------------------------------------
Objdeque:
(merlin)[ORTN] 46) ocamlc -c -i objdnode.ml
class ['a] objdnode :
  'a ->
  object
    val mutable aft : 'a objdnode option
    val node : 'a
    method aftof : unit -> 'a objdnode option
    method nodeof : unit -> 'a
    method setaft : 'a objdnode option -> unit
  end
(merlin)[ORTN] 48) ocamlc -c -i objdeque.ml
exception Empty
class ['a] objdeque :
  'a ->
  object
    constraint 'a = ('a Objdnode.objdnode as 'b) option
    val mutable hd : 'a
    val mutable tl : 'a Objdnode.objdnode as 'c
    method connect : 'a objdeque -> unit
    method convert : 'a list
    method createreader : 'a objdeque
    method gethead : 'a list
    method head : unit -> 'a
    method hpop : 'a
    method hpush : 'a -> unit
    method hread : 'a
    method iter_p : (int -> 'a -> unit) -> unit
    method tail : unit -> ('a Objdnode.objdnode as 'd)
    method tpush : 'a -> unit
  end



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET