caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Johan Baltié" <johan.baltie@wanadoo.fr>
To: Alessandro Baretta <alex@baretta.com>, Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Recovering masked methods (with CamlP4?)
Date: Tue, 16 Jul 2002 12:32:40 +0100	[thread overview]
Message-ID: <20020716113240.M56995@wanadoo.fr> (raw)
In-Reply-To: <3D33FE98.6000001@baretta.com>

> 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


  reply	other threads:[~2002-07-16 11:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-15 23:13 [Caml-list] Recovering masked methods Alessandro Baretta
2002-07-16  1:15 ` Jacques Garrigue
2002-07-16  9:28   ` Alessandro Baretta
2002-07-16  9:48     ` Laurent Vibert
2002-07-16 10:08       ` Johan Baltié
2002-07-16 10:10       ` Alessandro Baretta
2002-07-16  9:59     ` Johan Baltié
2002-07-16 11:08       ` [Caml-list] Recovering masked methods (with CamlP4?) Alessandro Baretta
2002-07-16 11:32         ` Johan Baltié [this message]
2002-07-16 12:52           ` Alessandro Baretta
2002-07-16 12:26         ` Daniel de Rauglaudre
2002-07-16 12:54           ` Alessandro Baretta
2002-07-17  9:26             ` Daniel de Rauglaudre
2002-07-16 13:32         ` John Prevost
2002-07-16 13:35           ` John Prevost
2002-07-16 14:06           ` Alessandro Baretta
2002-07-16 14:15             ` Johan Baltié
2002-07-16 14:29               ` Alessandro Baretta
2002-11-11  9:20         ` Eray Ozkural
2002-07-16 10:45     ` [Caml-list] Recovering masked methods John Prevost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020716113240.M56995@wanadoo.fr \
    --to=johan.baltie@wanadoo.fr \
    --cc=alex@baretta.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).