From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA21305; Thu, 13 Sep 2001 19:40:54 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA21043 for ; Thu, 13 Sep 2001 19:40:54 +0200 (MET DST) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8DHeqP27146; Thu, 13 Sep 2001 19:40:52 +0200 (MET DST) Received: from localhost (patrick@localhost) by fledge.watson.org (8.11.6/8.11.5) with SMTP id f8DHehY02714; Thu, 13 Sep 2001 13:40:43 -0400 (EDT) (envelope-from patrick@watson.org) Date: Thu, 13 Sep 2001 13:40:42 -0400 (EDT) From: Patrick M Doane To: Didier Le Botlan cc: caml-list@inria.fr Subject: Re: [Caml-list] Unbound type variables In-Reply-To: <3BA0F11F.DE0303F1@beaune.inria.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Interesting - thanks to you and Olivier for pointing this out! I wasn't aware of how to do this or what the 'constraint' aspect might be used for. Patrick On Thu, 13 Sep 2001, Didier Le Botlan wrote: > What do you think of a parameterized class ? > > class ['a] c = object > method m (x:'a) = > match x with > | `A -> () > | `B -> () > | `C -> () > end > > class [[< `A | `B | `C] as 'b] c : > object constraint 'b = 'b method m : 'b -> unit end > > Beware that the 'a parameter is freezed for each instance of the class, > that is you cannot call method m twice on the same object with > incompatible arguments. > > > -- > Didier Le Botlan > http://cristal.inria.fr/~lebotlan > ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr