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 BAA12042; Tue, 23 Mar 2004 01:29:39 +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 BAA11966 for ; Tue, 23 Mar 2004 01:29:38 +0100 (MET) Received: from kefka.frap.net (adsl-64-162-212-212.dsl.snfc21.pacbell.net [64.162.212.212]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i2N0UBKW005817 for ; Tue, 23 Mar 2004 01:30:11 +0100 Received: by kefka.frap.net (Postfix, from userid 1000) id 566186A50C8; Mon, 22 Mar 2004 16:29:28 -0800 (PST) Date: Mon, 22 Mar 2004 16:29:26 -0800 From: Kenneth Knowles To: Yamagata Yoriyuki Cc: alex@baretta.com, caml-list@inria.fr Subject: Re: [Caml-list] Delegation based OO Message-ID: <20040323002926.GA30057@kefka.frap.net> References: <405EBD5D.1000406@baretta.com> <20040323.080154.71097954.yoriyuki@mbg.ocn.ne.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040323.080154.71097954.yoriyuki@mbg.ocn.ne.jp> User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; knowles:99 caml-list:01 delegates:01 foo:01 overwrite:01 foo:01 strictness:01 inherit:01 inherit:01 int:01 int:01 float:02 string:03 object:03 object:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 313 > class *type* does_something = object ... end > > class does_more (an_object:#does_something) = object > delegates an_object > ... > end > > "an_object" may have a method, say, "an_object#foo : int". > "does_more" could overwrite the method, and define "does_more#foo : > float". Now, what type should "self#pooh" have in the definition of > an_object? This is a type error, just as if you override a class method with one of a different type: # class x = object method y = 3 end;; class x : object method y : int end # class y = object inherit x method y = 4 end;; class y : object method y : int end # class z = object inherit x method y = "hello" end;; This expression has type string but is here used with type int The same strictness could be applied to delegation. Kenn ------------------- 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