caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Help --- type checker and I agree to disagree...
@ 1999-09-24 13:08 Steve Stevenson
  0 siblings, 0 replies; only message in thread
From: Steve Stevenson @ 1999-09-24 13:08 UTC (permalink / raw)
  To: caml-list

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-09-24 16:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-24 13:08 Help --- type checker and I agree to disagree Steve Stevenson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).