From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA30989 for caml-redistribution; Mon, 31 May 1999 11:49:53 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA29091 for ; Sun, 30 May 1999 22:23:18 +0200 (MET DST) Received: from fermi.cnam.fr (fermi.cnam.fr [163.173.128.60]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id WAA10766 for ; Sun, 30 May 1999 22:23:17 +0200 (MET DST) Received: from 163.173.128.93 (phone-client.cnam.fr [163.173.128.93]) by fermi.cnam.fr (8.8.8/jpm-301097) with SMTP id WAA19888 ; Sun, 30 May 1999 22:23:15 +0200 (MET DST) Message-ID: <37519E82.7D14@cnam.fr> Date: Sun, 30 May 1999 22:24:35 +0200 From: Olivier Chararas Organization: Critical lack of X-Mailer: Mozilla 3.04 (Macintosh; I; 68K) MIME-Version: 1.0 To: caml-list@inria.fr Subject: OCAML parametric class coercion Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis (* 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)