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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b8b8a54001adc4d2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!c13g2000cwb.googlegroups.com!not-for-mail From: danmcleran@hotmail.com Newsgroups: comp.lang.ada Subject: Re: Possible Ada deficiency? Date: 24 Jan 2005 09:23:01 -0800 Organization: http://groups.google.com Message-ID: <1106587381.815048.46450@c13g2000cwb.googlegroups.com> References: <1104516913.718856.94090@z14g2000cwz.googlegroups.com> <1105936816.827842.186420@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 192.55.20.36 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1106587385 9158 127.0.0.1 (24 Jan 2005 17:23:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 24 Jan 2005 17:23:05 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: c13g2000cwb.googlegroups.com; posting-host=192.55.20.36; posting-account=LSix6gsAAACmBFWMCbh6syCaua0lawvj Xref: g2news1.google.com comp.lang.ada:7962 Date: 2005-01-24T09:23:01-08:00 List-Id: > Wrapping the type in a nested package can be used to > accomplish approximately what you need. What I wanted was a way to prevent child packages from messing with certain areas of a parent package. Using Tucker's suggestion, I put my type implementation into a nested package. I believe that this will prevent any other component, including child packages, from messing with Secret_Value directly. Here's what I've come up with: package Some_Package is package Some_Package_Implementation_Package is type Some_Type is limited private; procedure Set_Secret_Value ( Obj : in out Some_Type; New_Value : in Integer); function Get_Secret_Value (Obj : in Some_Type) return Integer; private type Some_Type is record Secret_Value : Integer := Integer'First; end record; end Some_Package_Implementation_Package; subtype Some_Type is Some_Package_Implementation_Package.Some_Type; procedure Set_Secret_Value ( Obj : in out Some_Type; New_Value : in Integer) renames Some_Package_Implementation_Package.Set_Secret_Value; function Get_Secret_Value (Obj : in Some_Type) return Integer renames Some_Package_Implementation_Package.Get_Secret_Value; end Some_Package;