Version française
Home     About     Download     Resources     Contact us    
Browse thread
Help --- type checker and I agree to disagree...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Steve Stevenson <steve@c...>
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