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 TAA20770; Thu, 13 Sep 2001 19:15:26 +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 TAA20741 for ; Thu, 13 Sep 2001 19:15:25 +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 f8DHFNP26228 for ; Thu, 13 Sep 2001 19:15:24 +0200 (MET DST) Received: from localhost (patrick@localhost) by fledge.watson.org (8.11.6/8.11.5) with SMTP id f8DHF9802384 for ; Thu, 13 Sep 2001 13:15:09 -0400 (EDT) (envelope-from patrick@watson.org) Date: Thu, 13 Sep 2001 13:15:09 -0400 (EDT) From: Patrick M Doane To: caml-list@inria.fr Subject: [Caml-list] Unbound type variables Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 Now, there is a simple solution to the problem: type t = [ `A | `B | `C] ... match (x:t) with but one of the benefits of using polymorphic variants is that I can usually avoid such redundant declarations. I'm also suprised by the inferred type, since the polymorphism just causing a failure and there isn't anyway I'm aware of to be able to bind that row variable to the type of the class. Would it be better to type the expression differently from within an object context? Any other ways I can improve what I'm doing? Patrick ------------------- 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