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-Thread: 103376,e5bfd51af02edca2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Re-exporting primitive operations of a private type (like "-", and 'min) References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 02 Nov 2005 03:35:45 GMT NNTP-Posting-Host: 67.3.222.101 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1130902545 67.3.222.101 (Tue, 01 Nov 2005 19:35:45 PST) NNTP-Posting-Date: Tue, 01 Nov 2005 19:35:45 PST Xref: g2news1.google.com comp.lang.ada:6104 Date: 2005-11-02T03:35:45+00:00 List-Id: Anonymous Coward wrote: > That would probably work as long as the definition of Subtract does a > type conversion explicitly on the Left and Right to the parent types. > But what are the advantages? Why would I define a Subtract operation > and use a renames clause, when I can simply define a "-" operation > directly? No. Subtract is defined for the parent type as a renaming of "-". Thus, calling Subtract is the same as calling "-". The private type derives from the parent type after the declaration of Subtract, so it also has Subtract defined as a renaming of the predefined "-". It also has a redefined "-" that must be explicitly defined. The redefined "-" is then defined as a renaming of Subtract, so calling the redefined "-" is the same as calling Subtract, and calling Subtract is the same as calling the predefined "-". That's kind of a mouthful, but it means the explicitly defined "-" for the private type is actually the predefined "-". The advantage of this approach is that "-" remains the predefined operation for the type. It may also be a little shorter and easier to get right. > The "-" operation must still be replaced, and it still has to have a > declaration in the public part. So in your case above, there would > have to be a > > function "-" (Left, Right : in Private_Distance_Type) > return Private_Distance_Type; > > in the public part. Certainly. That's the only reason you'd go through all this. -- Jeff Carter "In the frozen land of Nador they were forced to eat Robin's minstrels, and there was much rejoicing." Monty Python & the Holy Grail 70