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, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5b3c19b1631bb558 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-11-02 05:50:07 PST Path: supernews.google.com!sn-xit-02!supernews.com!12.127.16.134.MISMATCH!attmtf.ip.att.net!attor2!ip.att.net!news.hitter.net!news!news.crc.com!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: Reflection (was: Re: The best thing/greatest feature summary) Date: Thu, 2 Nov 2000 06:51:59 -0600 Organization: CRC: A wholly owned subsidiary of Thermo Electron Message-ID: <8tro07$j76$1@hobbes2.crc.com> References: <0O9M5.381209$i5.6373651@news1.frmt1.sfba.home.com> NNTP-Posting-Host: 198.175.145.56 X-Trace: hobbes2.crc.com 973169479 19686 198.175.145.56 (2 Nov 2000 12:51:19 GMT) X-Complaints-To: abuse@crc.com NNTP-Posting-Date: 2 Nov 2000 12:51:19 GMT X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: supernews.google.com comp.lang.ada:1718 Date: 2000-11-02T12:51:19+00:00 List-Id: Sorry about the earlier post. This was the improved version I meant to post: with Ada.Strings.Fixed; with Ada.Tags; generic package Reflection is Name : constant String; private -- Reflection type T is abstract tagged null record; S : constant String := Ada.Tags.Expanded_Name (T'Tag); Last : constant Positive := Ada.Strings.Fixed.Index (S (1 .. S'Last - 2), ".", Ada.Strings.Backward) - 1; Name : constant String := S (1 .. Last); end Reflection; package One is procedure P; procedure Q; end One; with Reflection, Ada.Text_IO; package body One is package Me is new Reflection; procedure P is begin Ada.Text_Io.Put_Line (Me.Name); end P; procedure Q is package Me is new Reflection; begin Ada.Text_Io.Put_Line (Me.Name); end Q; end One; with Reflection, One, Ada.Text_IO; procedure Test_Reflection is package Me is new Reflection; begin One.P; --> ONE One.Q; --> ONE.Q Ada.Text_IO.Put_Line (Me.Name); --> TEST_REFLECTION end Test_Reflection;