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 NAA28981; Wed, 12 May 2004 13:45:55 +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 NAA28859 for ; Wed, 12 May 2004 13:45:54 +0200 (MET DST) Received: from fafnir (furie.ens-lsh.fr [193.51.131.254]) by concorde.inria.fr (8.12.10/8.12.10) with SMTP id i4CBjrSH018744 for ; Wed, 12 May 2004 13:45:53 +0200 Received: from ([172.16.1.1]) by fafnir; Wed, 12 May 2004 13:44:37 +0200 (CEST) Received: from avalon.ens-lsh.fr (localhost [127.0.0.1]) by avalon.ens-lsh.fr (8.12.8/8.12.8) with ESMTP id i4CCjINW007807 for ; Wed, 12 May 2004 13:45:18 +0100 (WEST) Received: from ens-notes1.ens-lsh.fr (ens-notes1.ens-lsh.fr [10.2.1.44]) by avalon.ens-lsh.fr (8.12.8/8.12.8) with ESMTP id i4CCjHau007804 for ; Wed, 12 May 2004 13:45:17 +0100 (WEST) Received: from mostha ([10.3.25.3]) by ens-notes1.ens-lsh.fr (Lotus Domino Release 5.0.10) with SMTP id 2004051213454943:27999 ; Wed, 12 May 2004 13:45:49 +0200 Date: Wed, 12 May 2004 13:43:50 +0200 From: Damien To: caml-list@inria.fr Subject: Re: [Caml-list] 'b is unbound Message-Id: <20040512134350.7be8c813.Damien.Pous@ens-lyon.fr> In-Reply-To: <16545.50388.591926.577605@soggy.deldotd.com> References: <16545.50388.591926.577605@soggy.deldotd.com> Organization: mosthagloups X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i386-pc-linux-gnu) Mime-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on ens-notes1/ENS-LSH(Release 5.0.10 |March 22, 2002) at 12/05/2004 13:45:49, Serialize by Router on ens-notes1/ENS-LSH(Release 5.0.10 |March 22, 2002) at 12/05/2004 13:45:50, Serialize complete at 12/05/2004 13:45:50 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Miltered: at concorde with ID 40A20E71.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; damien:01 damien:01 ens-lyon:01 caml-list:01 2004:99 inference:01 toto:01 toto:01 bigarray:01 bigarray:01 int:01 int:01 wrt:01 polymorphic:01 float:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 11 May 2004 23:31:48 -0700 briand@aracnet.com wrote: > I'm getting the following error: > > method op : > (float, 'a, 'b) Bigarray.Array2.t -> > float array -> float array -> unit > end > The method op has type > (float, 'a, 'b) Bigarray.Array2.t -> float array -> float array -> > unit > where 'b is unbound > > Is 'b really unbound, or is the inferencer simply unable to figure out > what the type should be ? polymorphic methods require to be explicitly typed (this kind of type inference should lead to the one for system F) # class o = object method id x = x end;; Some type variables are unbound in this type: class o : object method id : 'a -> 'a end The method id has type 'a -> 'a where 'a is unbound # class o = object method id: 'a.'a -> 'a = fun x -> x end;; class o : object method id : 'a -> 'a end # let o = new o in o#id 5, o#id "toto";; - : int * string = (5, "toto") or maybe you want the whole class to be parametrized wrt 'a : # class ['a] o = object method id (x:'a) = x end;; class ['a] o : object method id : 'a -> 'a end # let o = new o in o#id 5, o#id "toto";; This expression has type string but is here used with type int hope this helps, damien ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners