comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: meaning of "current instance"
Date: 1999/11/12
Date: 1999-11-12T00:00:00+00:00	[thread overview]
Message-ID: <382cc06a_2@news1.prserv.net> (raw)
In-Reply-To: mG%W3.5997$dp.134843@typhoon-sf.snfc21.pbi.net

In article <mG%W3.5997$dp.134843@typhoon-sf.snfc21.pbi.net> , 
tmoran@bix.com  wrote:

>   Is it legal, or is it not?

It doesn't matter if it's legal.  Don't do it.


> The only mention of "current instance"
> of a type that I see in the LRM index is to 8.6(17), which leaves me
> guessing that the usual elaboration order rules apply, even though
> things can be written that are normally un-writeable.

See 3.10.2 (24).


>   If the order of components in a record declaration is changed, it
> usually doesn't break things, or at least the compiler will point out
> that you are using something before it exists.  A usage of "current
> instance" presumably is a red flag to a maintenance programmer that
> re-ordering is treading on thin ice.

No.  Using the "current instance" of the type is *very* common.  It's
how we implement multiple inheritance in Ada95:

  type Digital_Clock (Timer : access Timer_Type) is
    new Limited_Controlled with record
      Hour_Observer : Hour_Observer_Type (Digital_Clock'Access);
      Min_Observer  : Min_Observer_Type (Digital_Clock'Access);
      Sec_Observer  : Sec_Observer_Type (Digital_Clock'Access);
    end record;


(Type Digital_Clock effectively has 4 parent types.)



--
Get the FAQs about evolution and creationism.

<http://www.talkorigins.org/origins/faqs.html>




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

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-11  0:00 meaning of "current instance" Matthew Heaney
1999-11-11  0:00 ` Robert A Duff
1999-11-11  0:00   ` Matthew Heaney
1999-11-11  0:00     ` Tucker Taft
1999-11-15  0:00   ` Tucker Taft
1999-11-15  0:00     ` tmoran
1999-11-15  0:00       ` Tucker Taft
1999-11-11  0:00 ` tmoran
1999-11-11  0:00   ` Matthew Heaney
1999-11-12  0:00     ` tmoran
1999-11-11  0:00       ` Matthew Heaney
1999-11-12  0:00         ` tmoran
1999-11-12  0:00           ` Matthew Heaney
1999-11-12  0:00             ` tmoran
1999-11-12  0:00               ` Matthew Heaney [this message]
1999-11-13  0:00             ` Robert A Duff
1999-11-13  0:00           ` Nick Roberts
1999-11-13  0:00             ` Robert A Duff
1999-11-14  0:00               ` tmoran
1999-11-13  0:00                 ` Matthew Heaney
1999-11-15  0:00                   ` John English
1999-11-15  0:00                     ` Matthew Heaney
replies disabled

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