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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,76ec5d55630beb71 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-02 07:23:23 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Message-ID: <3EDB5DBE.4070807@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada 200X References: <3EDAD07A.3010200@attbi.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1054563802 24.62.164.137 (Mon, 02 Jun 2003 14:23:22 GMT) NNTP-Posting-Date: Mon, 02 Jun 2003 14:23:22 GMT Organization: AT&T Broadband Date: Mon, 02 Jun 2003 14:23:22 GMT Xref: archiver1.google.com comp.lang.ada:38347 Date: 2003-06-02T14:23:22+00:00 List-Id: Larry Kilgallen wrote: > I am not the original poster, but the case where I find this troublesome > is trying to replace a method for a parent type with enhanced code to: > > 1. Do something special > > 2. Do whatever the method for the parent type would do > > 3. Do something else special > > The lack of a construct to specify "corresponding method of ancestor" > seems to me to be what breaks information hiding. Oh, that is so easy that I never thought of people having problems with it. I'll give an example: type Foo is tagged... procedure Bar(F: in out Foo); ... type New_Foo is new Foo with... procedure Bar(F: in out New_Foo); ... procedure Bar(F: in out New_Foo) is begin Do(Something_Special); Bar(Foo(F)); -- view conversion Do(Something_Else_Special); end Bar; The view conversion passes the Foo part of a New_Foo object to the parent Bar by reference. So the parent operation only sees the parts of the New_Foo object that it knows about. When writing Initialize, Adjust, and Finalize operations for controlled types, this idiom is pretty standard. In my experience I have never needed access discriminants, but some smart people say they are needed for compatibility with other OO languages.