comp.lang.ada
 help / color / mirror / Atom feed
From: Claude SIMON <claude.simon@setra.fr>
Subject: Re: Package name
Date: Wed, 16 May 2001 18:45:13 +0200
Date: 2001-05-16T16:43:59+00:00	[thread overview]
Message-ID: <3B02AE98.BDAAC10E@setra.fr> (raw)
In-Reply-To: 9du16o$fr3$1@nh.pace.co.uk

You could use the external_tag attribute of a tagged type :

with Text_Io;
procedure P1 is
   type Trace is tagged null record;

   procedure P2 is
      type Trace is tagged null record;
   begin
       Text_Io.Put_Line (Trace'External_Tag);
   end P2;

begin
    P2;
    Text_Io.Put_Line (Trace'External_Tag);
end P1;


Marin David Condic a �crit :

> I think the idea is to have something like a pragma or attribute that lets
> you get the name of the module you are in as a string. I have frequently
> wished I could write a more general exception handler (or error handler or
> simple messages at runtime...) by having something like "Context'Image" or
> some other function that would provide the fully qualified name of the
> subprogram, package, whatever that I am currently in. Example:
>
> package body Some_Package is
>     procedure Some_Procedure is
>         ....
>         Put_Line ("Running in: " & Current_Context'Image) ;
>
> having that print:
>
> Running in: Standard.Some_Package.Some_Procedure
>
> It would be useful for diagnostics in the event of various errors or other
> conditions. Maybe even have "Current_Context'Line_Number" and similar
> capabilities? One would wish that Exception_Message and
> Exception_Information had this sort of information in their returned strings
> (Never seen it myself in the implementations I've used), but I think you'd
> want it to be available without an exception being raised.
>
> And of course, one could also want some sort of access to the dynamic
> context as well. (The call stack). There's no limit to the things I can
> want. But as my mother used to observe, "People in Hell want ice water,
> too!"  :-)
>
> MDC
> --
> Marin David Condic
> Senior Software Engineer
> Pace Micro Technology Americas    www.pacemicro.com
> Enabling the digital revolution
> e-Mail:    marin.condic@pacemicro.com
> Web:      http://www.mcondic.com/
>
> "Preben Randhol" <randhol+abuse@pvv.org> wrote in message
> news:slrn9g509m.f4.randhol+abuse@kiuk0156.chembio.ntnu.no...
> > On Wed, 16 May 2001 14:56:38 +0200, Atle R�stad wrote:
> > > Is it possible to print out the package name?
> > >
> > > It would be a nice feature in tracing. Maybe even print the
> > > procedure/function name.
> >
> > What do you mean?
> >
> > --
> > Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
> >                  �For me, Ada95 puts back the joy in programming.�




  reply	other threads:[~2001-05-16 16:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-16 12:56 Package name Atle R�stad
2001-05-16 13:28 ` Preben Randhol
2001-05-16 13:46   ` Atle R�stad
2001-05-16 14:00   ` Marin David Condic
2001-05-16 16:45     ` Claude SIMON [this message]
2001-05-17 13:59       ` Marin David Condic
2001-05-17 15:06         ` Samuel T. Harris
2001-05-16 18:24     ` Randy Brukardt
2001-05-16 16:10 ` Jeffrey Carter
2001-05-16 17:08 ` David C. Hoos, Sr.
  -- strict thread matches above, loose matches on Subject: below --
2001-05-16 16:17 Beard, Frank
2001-05-16 18:11 ` tmoran
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox