comp.lang.ada
 help / color / mirror / Atom feed
From: Nick Roberts <nick.roberts@acm.org>
Subject: Re: visibility of private incomplete types
Date: Sat, 30 Oct 2004 04:13:14 +0100
Date: 2004-10-30T04:13:14+01:00	[thread overview]
Message-ID: <2ugf6aF29kg38U1@uni-berlin.de> (raw)
In-Reply-To: <Qotgd.16$HT3.13@trndny08>

Frank J. Lhota 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.

I have to laugh. I now recall that I have used this technique /myself/
in the past. What a memory! RM95 3.10.1 (3). Sorry.

-- 
Nick Roberts



  reply	other threads:[~2004-10-30  3:13 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
2004-10-30  3:13         ` Nick Roberts [this message]
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