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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,93d7def3eeefbc26 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Private area and child packages Date: 29 Dec 2004 16:44:31 -0500 Organization: Cuivre, Argent, Or Message-ID: References: <1104293158.276241.42640@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1104356740 96290 212.85.156.195 (29 Dec 2004 21:45:40 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Wed, 29 Dec 2004 21:45:40 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: <1104293158.276241.42640@f14g2000cwb.googlegroups.com> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:7310 Date: 2004-12-29T16:44:31-05:00 danmcleran@hotmail.com writes: > I don't want any other component to be able to manipulate the > Secret_Value record component, not even a child package of > Some_Package. > > Is there any way to do this? In C++, there is something called the > PIMPL idiom, where you hide implementation detail by holding a pointer > to an incomplete class, like this: > > //SecretClass.h > > class Implementation;//Class not yet fully defined > > class SecretClass > { > public: > //publicly visible stuff > private: > Implementation* pImplementation; > }; Use the same mechanism in Ada; declare an incomplete type and a pointer to it: package Some_Package is type Secret_Type is private; private type Really_Secret_Type; type Access_Really_Secret_Type is access Really_Secret_Type; type Secret_Type is record Secret_Value : Access_Really_Secret_Type; end record; end Some_Package; -- -- Stephe