comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <eachus@mitre.org>
Subject: Re: hunting snarks
Date: 1999/12/21
Date: 1999-12-21T21:50:24+00:00	[thread overview]
Message-ID: <385FF7BF.864DE1E8@mitre.org> (raw)
In-Reply-To: 385E8D68.D902D2A4@averstar.com

Tucker Taft wrote:
 
> When defining a generic "mix-in" it is quite reasonable to
> have an operation that overrides an inherited operation.  It is
> also just as reasonable to be creating a new operation.  It really
> requires knowledge of the particular instantiation in some cases,
> and clearly you don't have that knowledge when writing the
> generic itself.  So that is what this pragma is used for.
> The pragma is not to be read as "allow accidental overriding" but rather
> as "allow intentional overriding upon instantiation."

  There is another idiom where you extend an (abstract) type using
several instantiation, and then export the final result as a concete
type.  When using this to extend a type by adding both operations and
state/data fields.  It can be the case that some extentions have similar
profiles, and thus override, but neither the author of the mix-in or the
user cares.  (From the user's viewpoint, the (actually overridden)
operations are overloaded, and require qualification or renaming, while
from the author's viewpoint, he cannot see and never cares about the
other inherited operations.

   Sound complex?  It isn't, and actually allows a classical abstract
type to be constructed from many components.  Due to the way
generics/templates work, you have three levels of abstraction.  The user
and the component author see a single level, and the creator of the
abstract type deals only with explicit interactions required by the
design.  There are no implicit interactions to trip him up.
  
> For anyone instantiating the generic, this is presumably a
> flag to indicate that some additional care may be required here.
> Without the pragma, you might be forced to create two versions
> of the same generic, one with a pragma Overrides, and one without,
> which definitely seems like overkill in some situations.

   And an invitation to a combinatorial explosion.
-- 

                                        Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




      reply	other threads:[~1999-12-21  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-14  0:00 hunting snarks Stephen Leake
1999-12-14  0:00 ` Robert A Duff
1999-12-14  0:00   ` Tucker Taft
1999-12-17  0:00     ` Simon Wright
1999-12-20  0:00       ` Tucker Taft
1999-12-21  0:00         ` Robert I. Eachus [this message]
replies disabled

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