From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8dc50f1b24590126 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny08.POSTED!0f19ed38!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: <4180fb61$0$20941$9b4e6d93@newsread2.arcor-online.net> <4181108a_1@baen1673807.greenlnk.net> <9NWdnRZle_mB7RzcRVn-uQ@megapath.net> <2uf1loF27r1iqU1@uni-berlin.de> Subject: Re: visibility of private incomplete types X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response Message-ID: Date: Fri, 29 Oct 2004 15:33:04 GMT NNTP-Posting-Host: 141.154.232.179 X-Complaints-To: abuse@verizon.net X-Trace: trndny08 1099063984 141.154.232.179 (Fri, 29 Oct 2004 11:33:04 EDT) NNTP-Posting-Date: Fri, 29 Oct 2004 11:33:04 EDT Xref: g2news1.google.com comp.lang.ada:5876 Date: 2004-10-29T15:33:04+00:00 List-Id: "Nick Roberts" 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.