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,5b3c19b1631bb558 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-11-02 00:42:37 PST Path: supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Reflection (was: Re: The best thing/greatest feature summary) References: X-Newsreader: Tom's custom newsreader Message-ID: <0O9M5.381209$i5.6373651@news1.frmt1.sfba.home.com> Date: Thu, 02 Nov 2000 08:42:36 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 973154556 24.20.190.201 (Thu, 02 Nov 2000 00:42:36 PST) NNTP-Posting-Date: Thu, 02 Nov 2000 00:42:36 PST Organization: @Home Network Xref: supernews.google.com comp.lang.ada:1711 Date: 2000-11-02T08:42:36+00:00 List-Id: >Or does instantiating this package within a routine actually work? (I don't >have an Ada compiler near me at the moment.) Using Gnat 3.13p, with Ada.Tags; generic package Reflection is Unit_Name : constant String; private -- Reflection type T is abstract tagged null record; Unit_Name : constant String := Ada.Tags.Expanded_Name (T'Tag); 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.unit_name);end p; procedure q is package myself is new reflection; begin ada.text_io.put_line(myself.unit_name); end q; end one; with reflection, one, ada.text_io; procedure test is package me is new reflection; begin one.p; --> ONE.ME.T one.q; --> ONE.Q.MYSELF.T ada.text_io.put_line(me.unit_name); --> TEST.ME.T end test;