comp.lang.ada
 help / color / mirror / Atom feed
From: stt@dsd.camb.inmet.com (Tucker Taft)
Subject: Re: Ada 90 inheritance request?
Date: Mon, 12 Dec 1994 03:15:03 GMT
Date: 1994-12-12T03:15:03+00:00	[thread overview]
Message-ID: <D0oH13.KMM@inmet.camb.inmet.com> (raw)
In-Reply-To: 3ca3vl$n14@lang8.cs.nyu.edu

In article <3ca3vl$n14@lang8.cs.nyu.edu>,
Cyrille Comar <comar@cs.nyu.edu> wrote:

> ...
>PROBLEM: I have defined a hierarchy or tagged types and now I would like
>         specialize one of them to be controlled (i.e. finalizable)

[Later you impose the additional requirement that the type be non-limited.]

One cop-out solution is to make the root type controlled (even though
OOP allows one to minimize the need to edit code when reusing it,
it doesn't eliminate it altogether).  Although this may seem be a bit of
a cop-out, it may be that if one descendant of a type wants to "add" 
finalization, then other descendants would also benefit from it.

Another approach is to simply make the new *components* 
controlled, rather than the type as a whole.  In general, 
I would recommend that components clean up "themselves," rather than 
rely on a clean-up routine of an enclosing type.  It seems to be
simpler and more flexible.  

To give the best answer, it would help to have a better idea of
what is the underlying problem you want to solve.  In the abstract
it is hard to make appropriate tradeoffs.  For example, it might be a 
sign that you are abusing the "Is-A" relationship if a descendant 
needs to finalize the object as a whole (as opposed to just its 
new components) while its ancestor types do not.  This might imply
that inheritance is the wrong approach to begin with, and some
other kind of type composition would fit the problem better.  E.g.,
perhaps you should make the planned parent type into a component
of your new type, rather than making the new type an extension of it.

More details would help...

>Cyrille Comar,                                  E-mail: comar@cs.nyu.edu
>Gnat Project                                    US phone: (212) 998-3489

-Tucker Taft  stt@inmet.com
Intermetrics, Inc.  



  parent reply	other threads:[~1994-12-12  3:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-23 21:33 Ada 90 inheritance request? S M Ryan
1994-12-02 16:46 ` Tucker Taft
1994-12-09 17:26   ` Cyrille Comar
1994-12-11 18:47     ` Bob Duff
1994-12-12  3:15     ` Tucker Taft [this message]
1994-12-13 19:02     ` John Goodsen
1994-12-14 19:49       ` John Goodsen
1994-12-15 18:41         ` Robert I. Eachus
1994-12-19 18:58           ` John Goodsen
1994-12-20 10:40             ` Robert I. Eachus
1994-12-21 16:02             ` Norman H. Cohen
1994-12-22  1:21             ` Bob Duff
1994-12-17 13:55       ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox