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 DAA32520; Thu, 20 Dec 2001 03:08:28 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 DAA32577 for ; Thu, 20 Dec 2001 03:08:26 +0100 (MET) Received: from favie.faith.gr.jp (favie.faith.gr.jp [61.127.175.250]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id fBK28O112979 for ; Thu, 20 Dec 2001 03:08:24 +0100 (MET) Received: from localhost (dhcp7.faith.gr.jp [192.168.1.17]) by favie.faith.gr.jp (8.9.3/8.9.3) with ESMTP id LAA09560; Thu, 20 Dec 2001 11:08:17 +0900 To: jim@farrand.net Cc: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] Polymorphic Variants and Objects In-Reply-To: <200112181411.30786@farrand.net> References: <200112181411.30786@farrand.net> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20011220110732T.garrigue@kurims.kyoto-u.ac.jp> Date: Thu, 20 Dec 2001 11:07:32 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Jim Farrand > Take a look at the following OCaml class type definition: > > class type foo = > object > method bar: [ `A | `B ] > end > > I want to be able to relax the type of bar so that it can return any variant > tag, rather than being limited to `A or `B. What about: class type ['a] foo = object constraint 'a = [> `A | `B] method bar : 'a end Since you want the variant to be polymorphic, you have to bind its variable somewhere. --------------------------------------------------------------------------- Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp JG ------------------- 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