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 LAA06702; Fri, 28 May 2004 11:25:53 +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 LAA08571 for ; Fri, 28 May 2004 11:25:52 +0200 (MET DST) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by concorde.inria.fr (8.12.10/8.12.10) with SMTP id i4S9PpSH013160 for ; Fri, 28 May 2004 11:25:51 +0200 Received: (qmail 16644 invoked by uid 65534); 28 May 2004 09:25:51 -0000 Received: from p4523e3d4.np.schlund.de (EHLO schluck.use.schlund.de) (212.227.35.69) by mail.gmx.net (mp023) with SMTP; 28 May 2004 11:25:51 +0200 X-Authenticated: #20477425 From: Michael Reply-To: micha-1@fantasymail.de To: Subject: [Caml-list] a class as method parameter... Date: Fri, 28 May 2004 11:25:50 +0200 User-Agent: KMail/1.6.1 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200405281125.50554.micha-1@fantasymail.de> X-Miltered: at concorde with ID 40B7059F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; val:01 unbound:02 unbound:02 string:03 string:03 object:03 object:03 parameter:04 variables:06 type:07 type:07 fun:08 michael:08 michael:08 doesn't:12 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I don't understand why this doesn't work: class one = object val name = "test" method name = name end;; class two = object method take_one o -> o#name end;; that gives: Some type variables are unbound in this type: class two : object method take_one : < name : 'a; .. > -> 'a end The method take_one has type (< name : 'b; .. > as 'a) -> 'b where 'a is unbound I have to declare: class two = object method take_one : 'a. (#one as 'a) -> string = fun o -> o#name end;; .. to get it work (from chapter 3.10 ) why has it to be declared this way? ( and not: class two = object method take_one ( o : #one ) = o#name end;; which also does not work: The method take_one has type (#one as 'a) -> string where 'a is unbound ) ?? thanks, Michael ------------------- 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