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 RAA20306; Fri, 23 Aug 2002 17:46:30 +0200 (MET DST) 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 RAA20532 for ; Fri, 23 Aug 2002 17:46:29 +0200 (MET DST) Received: from ebene.inrialpes.fr (ebene.inrialpes.fr [194.199.18.70]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g7NFkSD17223 for ; Fri, 23 Aug 2002 17:46:28 +0200 (MET DST) Received: from pop-serv.inrialpes.fr (pop-serv.inrialpes.fr [194.199.18.66]) by ebene.inrialpes.fr (8.11.6/8.11.6) with ESMTP id g7NFkPx24431 for ; Fri, 23 Aug 2002 17:46:25 +0200 (MEST) Received: from inrialpes.fr (adret.inrialpes.fr [194.199.23.65]) by pop-serv.inrialpes.fr (8.11.3/8.11.3/ImagV2) with ESMTP id g7NFkQJ10954 for ; Fri, 23 Aug 2002 17:46:26 +0200 (MEST) Message-ID: <3D6658D0.F18A453D@inrialpes.fr> Date: Fri, 23 Aug 2002 17:46:24 +0200 From: Frederic Tronel X-Mailer: Mozilla 4.76 [en] (X11; U; SunOS 5.8 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] Polymorphic methods Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello list, I've just compiled the new 3.05 version (I will change for 3.06 tomorrow), and start playing a little bit with polymorphic methods. But this small piece of code does not compile: class node = object val mutable t = None method set_t: 'a. 'a -> unit = fun nt -> t <- Some nt end File "essai.ml", line 4, characters 31-53: This method has type 'a -> unit which is less general than 'b. 'b -> unit while this one is OK (useless). class node = object val mutable t = None method set_t: 'a. 'a -> unit = fun nt -> () end class node : object val mutable t : 'a option method set_t : 'b -> unit end Where am I going wrong ?? Best regards, Frederic. ------------------- 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