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 LAA07862; Tue, 16 Jul 2002 11:59:43 +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 LAA07916 for ; Tue, 16 Jul 2002 11:59:42 +0200 (MET DST) Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g6G9xfT10604 for ; Tue, 16 Jul 2002 11:59:41 +0200 (MET DST) Received: from mel-rta7.wanadoo.fr (193.252.19.61) by mel-rto3.wanadoo.fr (6.5.007) id 3D1848E600B7BF4C; Tue, 16 Jul 2002 11:59:41 +0200 Received: from AlphaSystem.dnsalias.net (80.11.74.121) by mel-rta7.wanadoo.fr (6.5.007) id 3D2A78FA00378777; Tue, 16 Jul 2002 11:59:41 +0200 Received: from localhost ([127.0.0.1] helo=alphasystem.dnsalias.net) by AlphaSystem.dnsalias.net with esmtp (Exim 3.36 #1 (Debian)) id 17UP7L-000BB5-00; Tue, 16 Jul 2002 11:59:40 +0200 From: "Johan Baltié" To: Alessandro Baretta , Ocaml Subject: Re: [Caml-list] Recovering masked methods Date: Tue, 16 Jul 2002 10:59:39 +0100 Message-Id: <20020716095939.M27616@wanadoo.fr> In-Reply-To: <3D33E74C.6050307@baretta.com> References: <3D335729.3020307@baretta.com> <20020716101520Q.garrigue@kurims.kyoto-u.ac.jp> <3D33E74C.6050307@baretta.com> X-Mailer: Open WebMail 1.61 20020204 X-OriginatingIP: 192.6.2.192 (baltie_j) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > [sniped] > > > And you can always write > > > > let a_m = 1 > > class a = ... method m = a_m .. > > This is not viable. The toy code I have shown here does not > provide any real functionality, but in the real application > you have to imagine the following situation: > > class a = > object (self) > method m = method m1 = > ... > method mn = > end > > class b = > object (self) > inherit a as super_a > method m = ; super_a # m > method m1 = ; super_a # m1 > ... > method mn = ; super_a # mn > end > > class small_variant_of_b = > object (self) > inherit b as super_b > method m = super_b # super_a # m > (* All the specific stuff in method m is not needed *) > (* Yet, all other methods must be inherited from b *) > end > > Without the above notation, I could only think of copying > the code of method m out of class a and pasting it into > class small_variant_of_b, but this makes maintainance a > mess. And I am working on a production class system. No > good. However, I did not consider the following idea, which > is not bad indeed. In the absence of the notation I > described above, or of an equivalent one, I'll do as you > propose here. I do not agree with you on the usefullness of this kind of stuff. Basic OO theory says that the inheritance relation can be seen as a "is a" operator. If your "is a" means "is a with some variants", for me your modelization is not good. You should have: B' inherits A B inherits B' small_b_variant inherits B' Like this code factorisation seems to be easy to do. IMHO it's a good modelization constraint to forbid such stuff. > [resniped] Ciao Jo ------------------- 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