comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Visible or hidden derivation for controlled types ?
Date: 1997/03/16
Date: 1997-03-16T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680001603971555370001@news.ni.net> (raw)
In-Reply-To: 3329621A.3E9D@elca-matrix.ch


In article <3329621A.3E9D@elca-matrix.ch>, Mats.Weber@elca-matrix.ch wrote:

>There was a discussion some time ago in comp.lang.ada on whether Adjust,
>Finalize and Initialize for Controlled types was better done in the
>visible or private part of the package. In both cases, the type was
>visibly derived from Ada.Finalization.Controlled.
>
>I'd like to know if it is better to make types visibly derived from
>Ada.Finalization.Controlled, or do that derivation in the private part:

I think the general advice according to the Rational is that the derivation
be done privately.  The guideline is that clients shouldn't care whether
the type inherits from Controlled; that is an implementation detail.  If
clients really don't care, then it's an even better idea to hide the
derivation, so the client can't accidently call Initialize or Adjust.

Of course, you might be building a primitive abstraction, where the clients
really do care that the abstraction is controlled.  For example, a data
structure library might contain an "unbounded collection," not for use by
general clients, but used only to implement other
higher-level-of-abstraction data structures.  (And the controlled-ness is
in turn hidden from the clients of those higher-level abstractions.)

If your binary tree is for general consumption, then hide the derivation
from Controlled.

Matt

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  parent reply	other threads:[~1997-03-16  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-14  0:00 Visible or hidden derivation for controlled types ? Mats Weber
1997-03-15  0:00 ` Tom Moran
1997-03-17  0:00   ` Jon S Anthony
1997-03-16  0:00 ` Matthew Heaney [this message]
1997-03-16  0:00   ` Robert Dewar
replies disabled

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