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 LAA05577; Sun, 3 Nov 2002 11:58:05 +0100 (MET) 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 LAA06608 for ; Sun, 3 Nov 2002 11:58:05 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from smtp2.cp.tin.it (vsmtp2.tin.it [212.216.176.222]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gA3Aw4D02598 for ; Sun, 3 Nov 2002 11:58:04 +0100 (MET) Received: from dalamar.takhisis.org (80.117.62.188) by smtp2.cp.tin.it (6.5.019) id 3DB5E7CA00418491 for caml-list@inria.fr; Sun, 3 Nov 2002 11:58:03 +0100 Received: from lordsoth.takhisis.org (lordsoth.takhisis.org [192.168.1.119]) by dalamar.takhisis.org (8.12.6/8.12.6/Debian-7) with ESMTP id gA3Aw2PM001586 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL) for ; Sun, 3 Nov 2002 11:58:03 +0100 Received: from lordsoth.takhisis.org (lordsoth.takhisis.org [192.168.1.119]) by lordsoth.takhisis.org (8.12.6/8.12.6/Debian-8) with ESMTP id gA3AvRqQ011053 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sun, 3 Nov 2002 11:57:27 +0100 Received: (from zack@localhost) by lordsoth.takhisis.org (8.12.6/8.12.6/Debian-8) id gA3AvRb8011051 for caml-list@inria.fr; Sun, 3 Nov 2002 11:57:27 +0100 Date: Sun, 3 Nov 2002 11:57:27 +0100 From: Stefano Zacchiroli To: caml-list@inria.fr Subject: Re: [Caml-list] Open types and methods Message-ID: <20021103105727.GB10959@lordsoth.takhisis.org> Mail-Followup-To: caml-list@inria.fr References: <87bs57eyib.fsf@marant.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bs57eyib.fsf@marant.org> User-Agent: Mutt/1.4i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, Nov 03, 2002 at 11:30:36AM +0100, J?r?me Marant wrote: > I know that I cannot use open types as method parameter types, > like: > > method foo (w : #mother) = .... > > So, how can I pass to a method an object of a given class or > of its inherited classes, i.e. how to work this limitation > around? Just define the method as: method foo (w: #mother) = ... And cast the object when invoking foo: obj#foo (son :> mother) Cheers. -- Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro "I know you believe you understood what you think I said, but I am not sure you realize that what you heard is not what I meant!" -- G.Romney ------------------- 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