comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: hunting snarks
Date: 1999/12/20
Date: 1999-12-20T00:00:00+00:00	[thread overview]
Message-ID: <385E8D68.D902D2A4@averstar.com> (raw)
In-Reply-To: x7vbt7pxme9.fsf@pogner.demon.co.uk

Simon Wright wrote:
> 
> Tucker Taft <stt@averstar.com> writes:
> [...]
> >                           For special cases involving generics which
> > declare a type derived from a formal type, there is also a pragma
> > Might_Override which overrules Explicit_Overriding, to indicate that the
> > given subprogram might or might not override..
> 
> Doesn't sound like the sort of thing to encourage the safety guys to
> let us use all (any of) the good things in Ada!
> 
> Isn't accidental overriding almost bound to lead to error? (wasn't
> that the point at which all this started?)

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."

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.


-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




  reply	other threads:[~1999-12-20  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 [this message]
1999-12-21  0:00         ` Robert I. Eachus
replies disabled

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