Re: OCAML parametric class coercion

From: Benoit deBoursetty (b-db@graphics.lcs.mit.edu)
Date: Tue Jun 01 1999 - 06:44:22 MET DST


Date: Tue, 1 Jun 1999 00:44:22 -0400 (EDT)
From: Benoit deBoursetty <b-db@graphics.lcs.mit.edu>
To: Olivier Chararas <charar_o@cnam.fr>
Subject: Re: OCAML parametric class coercion
In-Reply-To: <37519E82.7D14@cnam.fr>

On Sun, 30 May 1999, Olivier Chararas wrote:

> # 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)

Ben ca, ca marche, je ne sais pas si c'est ce que tu cherches...
This works, I don't know if it's what you were looking for...

class ['a] bidu1((dev:'a)) =
  object(self)
    method rate(untruc : 'a truc) = untruc#essai
  end;;

Benoit de Boursetty
Benoit.de-Boursetty@polytechnique.fr



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