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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ca85d557480cf473 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-06 17:40:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!pcp01485549pcs.limstn01.de.comcast.NET!not-for-mail From: Ryan Tarpine Newsgroups: comp.lang.ada Subject: Re: Hiding a type Date: Sat, 06 Jul 2002 20:38:42 +0000 Message-ID: <3D275552.4090903@hotmail.com> References: <3D27263F.7070101@hotmail.com> <7kJV8.2438$gy3.1099236449@newssvr12.news.prodigy.com> <3D2733F4.8010304@hotmail.com> NNTP-Posting-Host: pcp01485549pcs.limstn01.de.comcast.net (68.82.51.136) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1026002425 20270435 68.82.51.136 (16 [151722]) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020617 X-Accept-Language: en-us, en Xref: archiver1.google.com comp.lang.ada:26916 Date: 2002-07-06T20:38:42+00:00 List-Id: Frank J. Lhota wrote: > My recommendation would be to skip the definition of Private_Type_Ptr > entirely, and define Public_Name as the access type: > > ... The idea is that if I have 3 kinds of nodes (N1, N2, N3) with respective access types, I can rename one to be the public type (Root). All private functions will take N1_Ptrs, N2_Ptrs, etc. Only the public functions should take a Root. Maybe N1_Ptr is at first the root type but later on another node type N4 is added and now N4_Ptr should be the root type. I want to make sure that all the private functions don't have to change; if I had skipped the definition of N1_Ptr and just used Root, then my private functions would have to be changed since they should not take a Root but instead a pointer to an N1. They should always take the same type regardless of what the root type is. Whew! I hope that doesn't sound as bad to you as it does to me :) I did just come up with a small hack, though. I can define the root to be the access type and then *subtype the root type* to make the private type. If the root type changes, I can then modify the private type to directly be an access to the original node type. I'm writing too much to explain myself; that means I must be doing something wrong :) It's kind of ugly, but it works. Cheers, Ryan