From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Help - Constructors - ASAP.
Date: 1998/08/10
Date: 1998-08-10T00:00:00+00:00 [thread overview]
Message-ID: <EACHUS.98Aug10171006@spectre.mitre.org> (raw)
In-Reply-To: m3vhodvevl.fsf@mheaney.ni.net
In article <m3vhodvevl.fsf@mheaney.ni.net> Matthew Heaney <matthew_heaney@acm.org> writes:
> This is helpful when you have a type that comes into existence because
> of a nested instantation. For example...
> with GQ;
> pragma Elaborate_All (GQ);
> package P is
> ...
> package Q is new GQ (...);
> type T is new Q.T with null record;
-- and this is the case where you want to inherit the construtor:
function Create_T(...) return T;
-- of course, if you forget to do this, the compiler will be
-- sure to remind you. ;-)
> ...
> end P;
-- and also in the package body:
function Create_T(...) return T is
begin return Q.T(Q.Create_T(...)); end Create_T;
It is a bit of a pain when you need to do it right, but as you can
see, it amounts to a line in the spec and two in the body.
> What you do NOT want to happen is to for a client to have to refer to
> P.Q.T. The client shouldn't have to care that T was brought into
> existence because of an instantiation; it's really an implementation
> detail. By using transitivity of visibility, the client can just refer
> to P.T, in effect "hiding" the fact that T comes from Q.
Exactly, the user of the abstraction should never need to pay
attention to the man behind the curtin.
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
next prev parent reply other threads:[~1998-08-10 0:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-07-23 0:00 Help - Constructors - ASAP Maxim Senin
1998-07-26 0:00 ` Matthew Heaney
1998-07-27 0:00 ` dennison
1998-07-30 0:00 ` Robert I. Eachus
1998-07-30 0:00 ` tedennison
1998-07-31 0:00 ` Matthew Heaney
1998-07-31 0:00 ` Mats Weber
1998-07-31 0:00 ` dennison
1998-08-01 0:00 ` Robert Dewar
1998-08-01 0:00 ` Matthew Heaney
1998-08-01 0:00 ` Matthew Heaney
1998-08-03 0:00 ` Mats Weber
1998-07-31 0:00 ` Robert I. Eachus
1998-08-01 0:00 ` Matthew Heaney
1998-08-01 0:00 ` Robert Dewar
1998-08-01 0:00 ` Matthew Heaney
1998-08-03 0:00 ` Mats Weber
1998-08-03 0:00 ` Matthew Heaney
1998-08-03 0:00 ` Mats Weber
1998-08-04 0:00 ` Matthew Heaney
1998-08-04 0:00 ` Mats Weber
1998-08-05 0:00 ` Matthew Heaney
1998-08-10 0:00 ` Robert I. Eachus [this message]
1998-08-03 0:00 ` tedennison
-- strict thread matches above, loose matches on Subject: below --
1998-07-15 0:00 Maxim Senin
1998-07-16 0:00 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox