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.2 required=5.0 tests=BAYES_00,FROM_WORDY, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ca85d557480cf473 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-07 06:59:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!feed1.news.rcn.net!rcn!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada Subject: Re: Hiding a type Date: Sun, 7 Jul 2002 09:58:48 -0400 Message-ID: References: <3D27263F.7070101@hotmail.com> <7kJV8.2438$gy3.1099236449@newssvr12.news.prodigy.com> <3D2733F4.8010304@hotmail.com> Reply-To: "Frank J. Lhota" X-Trace: UmFuZG9tSVbI21qn846Vyqg4XCoMQeoZNbSxFUMfv+AfhDMimRtQxXnip2ANgufm X-Complaints-To: abuse@rcn.com NNTP-Posting-Date: 7 Jul 2002 13:58:39 GMT X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Priority: 3 X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MSMail-Priority: Normal Xref: archiver1.google.com comp.lang.ada:26924 Date: 2002-07-07T13:58:39+00:00 List-Id: "Simon Wright" wrote in message news:x7vd6tziy2c.fsf@pushface.org... > "Frank J. Lhota" writes: > > > package Test is > > type Public_Name is limited private; > > function Initialize( File_Name : String ) return Public_Name; > > procedure Process( Input : Public_Name ); > > private > > type Private_Type is record ... end record; > > type Public_Name is access all Private_Type; > > end Test; > > I don't know if this will compile, but it's certainly not possible to > use it; if Public_Name is _limited_ private, clients have no > assignment operation. You've got a good point, but what you say is true of any implementation of Public_Name. One fix would be to make Initialize a procedure, as follows: package Test is type Public_Name is limited private; procedure Initialize( Item : in out Public_Name; File_Name : in String ); procedure Process( Input : Public_Name ); private ... type Public_Name is ...; end Test; This change is probably necessary irrespective of the implementation of Public_Name. Given further clarification by Ryan, I would recommend the following: package Test is type Public_Name is limited private; procedure Initialize( Item : in out Public_Name; File_Name : in String ); procedure Process( Input : Public_Name ); private -- May want to declare the following type as abstract. type Private_Root_Type is tagged record ... end record; type Public_Name is access all Private_Root_Type'Class; end Test;