OCAML parametric class coercion

From: Olivier Chararas (charar_o@cnam.fr)
Date: Sun May 30 1999 - 22:24:35 MET DST


Date: Sun, 30 May 1999 22:24:35 +0200
From: Olivier Chararas <charar_o@cnam.fr>
To: caml-list@inria.fr
Subject: OCAML parametric class coercion

(*
NAIVE REQUEST :
In this design the ellipsis won't be bound so I wanted to use coercion
but I can't figure out how to express the coercion with respect to
the parametric type.

Can you help me on syntax?
Or is the problem more fundamental?
Is this bad design anyway?

Thanks
*)

# class ['a] truc(init,(dev:'a)) =
  object(self)
   method essai = 1
  end
  ;;
class ['a] truc : 'b * 'a -> object method essai : int end
#
  class ['a] bidu1((dev:'a)) =
  object(self)
   method rate(untruc) = untruc#essai
  end
  ;;
Some type variables are unbound in this type:
  class ['a] bidu1 : 'a -> object method rate : < essai : 'b; .. > -> 'b
end
The method rate has type < essai : 'a; .. > -> 'a where .. is unbound
#
  class ['a] bidu2((dev:'a)) =
  object(self)
   method rate(untruc:truc) = untruc#essai
  end
  ;;
The type constructor truc expects 1 argument(s),
but is here applied to 0 argument(s)



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