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 TAA21181; Thu, 13 Sep 2001 19:36:41 +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 TAA20882 for ; Thu, 13 Sep 2001 19:36:40 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8DHaeP26971 for ; Thu, 13 Sep 2001 19:36:40 +0200 (MET DST) Received: from akasha.ijm.jussieu.fr (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.11.3/jtpda-5.3.3) with ESMTP id f8DHaXO50132 ; Thu, 13 Sep 2001 19:36:40 +0200 (CEST) Received: by akasha.ijm.jussieu.fr (Postfix, from userid 11004) id EAC4B3CE81; Thu, 13 Sep 2001 19:36:22 +0200 (CEST) From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15264.61078.326233.316979@akasha.ijm.jussieu.fr> Date: Thu, 13 Sep 2001 19:36:22 +0200 To: Patrick M Doane Cc: caml-list@inria.fr Subject: Re: [Caml-list] Unbound type variables In-Reply-To: References: X-Mailer: VM 6.96 under Emacs 20.7.1 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Patrick M Doane [Thursday 13 September 2001] : > > While writing code today, I came across an annoying problem with using > polymorphic variants and objects. The basic code fragment is this: > > class c = object > method m x = > match x with > | `A -> () > | `B -> () > | `C -> () > end > > which produces an error: > > The method m has type > [< `A | `B | `C] -> unit > where .. is unbound > ... there isn't anyway I'm aware of to be able to > bind that row variable to the type of the class. yes you can (if I understand you correctly) : class ['a] c = object method m : 'a -> unit = function | `A -> () | `B -> () | `C -> () end and you get class ['a] c : object constraint 'a = [< `A | `B | `C] method m : 'a -> unit end -- Olivier ------------------- 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