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 NAA09876; Tue, 16 Jul 2002 13:32:44 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA09958 for ; Tue, 16 Jul 2002 13:32:43 +0200 (MET DST) Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6GBWgb05471 for ; Tue, 16 Jul 2002 13:32:42 +0200 (MET DST) Received: from mel-rta9.wanadoo.fr (193.252.19.69) by mel-rto3.wanadoo.fr (6.5.007) id 3D1848E600B8C23B; Tue, 16 Jul 2002 13:32:42 +0200 Received: from AlphaSystem.dnsalias.net (80.11.74.121) by mel-rta9.wanadoo.fr (6.5.007) id 3D2A791A003B6294; Tue, 16 Jul 2002 13:32: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 17UQZN-000CAY-00; Tue, 16 Jul 2002 13:32:41 +0200 From: "Johan Baltié" To: Alessandro Baretta , Ocaml Subject: Re: [Caml-list] Recovering masked methods (with CamlP4?) Date: Tue, 16 Jul 2002 12:32:40 +0100 Message-Id: <20020716113240.M56995@wanadoo.fr> In-Reply-To: <3D33FE98.6000001@baretta.com> References: <3D335729.3020307@baretta.com> <20020716101520Q.garrigue@kurims.kyoto-u.ac.jp> <3D33E74C.6050307@baretta.com> <20020716095939.M27616@wanadoo.fr> <3D33FE98.6000001@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 > Johan Baltié wrote: > > > > 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. > > I strongly disagree. Inheritance, as pointed out previously > by someone on this list (I can't remember whom), is a > syntactic property of classes, whereas subtyping is a > semantic property of instances. Just now I have received a > post by John Prevost clarifying this. Uhh ? I have missed something. Can you forward me this post privately ? I cannot find it. It seems awful to me to hear that inheritance is "syntactic", because it does mean (for me) that nothing happen at runtime. > In my code, > class a = object method m = ... end > Provides basic functionality common to all my inheritance > hiearchy. Class a *also* defines the actual type of all my > inheritance hieararchy, so I do not use subtyping at all; I > use type *identity*. That's because I'm building a graph of > objects of different classes, so all the objects in the > graph need to have the same type. I only use inheritance > because of code sharing. Now, > class b = object inherit a ... end > performs extensive personalizations to the functionality > provided by class a, while always retaining the > functionality of the parent, which is accessed by sending > messages to super_a. Class var_b needs most of the > functionality provided by b, with the sole exception of one > method, which I call here m, which needs to be identical to > the one defined in the root of the hierarchy. Hence, for the > sake of code reuse, since var_b shares most of its code with > b, it must inherit from b; however, for the sake of not > having multiple copies of the same lines of code--a > maintainance issue--I *also* need var_b to inherit, albeit > indirectly, form a. This is my reason for requesting and > "explicit inheritance hierarchy" construct. You say "since var_b shares most of its code with b, it must inherit from b". If you do not like my little B' class (I do not understand why), then say "b share most of this code with var_b, it must inherit from var_b", with b a specialization of var_b. For me it's still modelization problem. 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