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 EAA07699; Sun, 7 Sep 2003 04:29:28 +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 EAA13817 for ; Sun, 7 Sep 2003 04:29:27 +0200 (MET DST) Received: from pacific-carrier-annex.mit.edu (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.7.21.83]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h872TQT13255 for ; Sun, 7 Sep 2003 04:29:26 +0200 (MET DST) Received: from central-city-carrier-station.mit.edu (CENTRAL-CITY-CARRIER-STATION.MIT.EDU [18.7.7.72]) by pacific-carrier-annex.mit.edu (8.12.4/8.9.2) with ESMTP id h872TP75021457 for ; Sat, 6 Sep 2003 22:29:25 -0400 (EDT) Received: from melbourne-city-street.mit.edu (MELBOURNE-CITY-STREET.MIT.EDU [18.7.21.86]) by central-city-carrier-station.mit.edu (8.12.4/8.9.2) with ESMTP id h872TPn8019869 for ; Sat, 6 Sep 2003 22:29:25 -0400 (EDT) Received: from [192.168.0.2] (h00095b4fa3a9.ne.client2.attbi.com [65.96.161.200]) ) by melbourne-city-street.mit.edu (8.12.4/8.12.4) with ESMTP id h872TOGr029634 for ; Sat, 6 Sep 2003 22:29:24 -0400 (EDT) Subject: [Caml-list] Is there a compact syntax for masking methods in an inherit From: Ryan R Newton To: caml-list@inria.fr Content-Type: text/plain Message-Id: <1062887193.3773.2363.camel@ffh.ro> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.3- Date: 06 Sep 2003 18:26:33 -0400 Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; newton:99 newton:99 camlers:01 monolithic:01 overriden:01 overriden:01 ideally:01 overlap:01 inherit:01 inherit:01 syntax:02 hierarchy:02 explicit:03 typing:03 classes:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello Camlers, I've developed a liking for using multiple inheritacnce heavily as follows: When I'm working on a library (say, an evolutionary computation library, or a distributed computing library), I'm real crazy about making composable "plug-and-play" units of functionality rather than a monolithic class hierarchy. That is, I like to make a base class along with small virtual "layer" classes. I combine different features by defining a new class which inherits from the base class and a subset of the layer classes. Is there a name for this sort of pattern? Is it a horrible idea for some reason? Anyway, the point of this post is: When inheriting the same method from two sources, I quite reasonably get this message: "Warning: the following methods are overriden by the inherited class:" What's the best way to get rid of it? (Without turning off all warnings.) Here's an example: class a = object (self) method f = 3 method g = self#f * 3 end class virtual b = object (self) method g = self#f * 4 end class c = object inherit a inherit b method h = 99 end Warning: the following methods are overriden by the inherited class: g Ideally, I'd like to make the overlap explicit and get rid of the warning at the same time by typing something like: inherit a without g Any ideas? --Ryan Newton ------------------- 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