From: "Frank J. Lhota" <NOSPAM.Lhota.adarose@verizon.net>
Subject: Re: visibility of private incomplete types
Date: Fri, 29 Oct 2004 15:33:04 GMT
Date: 2004-10-29T15:33:04+00:00 [thread overview]
Message-ID: <Qotgd.16$HT3.13@trndny08> (raw)
In-Reply-To: 2uf1loF27r1iqU1@uni-berlin.de
"Nick Roberts" <nick.roberts@acm.org> wrote in message
news:2uf1loF27r1iqU1@uni-berlin.de...
> Randy Brukardt wrote:
> Also, would I be right in saying that, in Ada 95, it is not permitted
> for a type declared (by an incomplete type declaration) in the private
> part of a package to be completed in the package's body?
No, this was permitted as early as Ada 83, and I used this technique many
times. For example, assume that we are writing a package that implements
widgets. Widgets will be implemented as pointers to a record, but of course
we will hide this implementation detail using a private type. We can also
hide the structure of this record type as follows:
package Widgets is
type Widget_Type is limited private;
procedure Open( Widget : in out Widget_Type; Name : in String );
procedure Close( Widget : in out Widget_Type );
...
private
type Widget_Data;
type Widget_Type is access Widget_Data;
end Widget;
This type of package specification in legal in both Ada 83 and Ada 95 (and
presumably in Ada 200x), for Widget_Data is never used in a way that
requires a full declaration. Of course, Widget_Data must be fully declared
in the package body.
next prev parent reply other threads:[~2004-10-29 15:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-28 12:03 visibility of private incomplete types Georg Bauhaus
2004-10-28 15:36 ` Martin Dowie
2004-10-28 22:19 ` Randy Brukardt
2004-10-29 14:16 ` Nick Roberts
2004-10-29 15:33 ` Frank J. Lhota [this message]
2004-10-30 3:13 ` Nick Roberts
2004-11-01 0:40 ` Dr. Adrian Wrigley
2004-12-09 21:21 ` Lionel Draghi
2004-12-10 4:06 ` Alexander E. Kopilovich
2004-12-10 9:23 ` Martin Krischik
2004-10-30 0:36 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox