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 X-Google-Thread: 103376,71aa44b9692e8206 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-17 04:51:15 PST Path: archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!opentransit.net!wanadoo.fr!oleane.net!oleane!setranews.setra.fr!not-for-mail From: Claude SIMON Newsgroups: comp.lang.ada Subject: Re: Package name Date: Wed, 16 May 2001 18:45:13 +0200 Organization: SETRA - CTOA Message-ID: <3B02AE98.BDAAC10E@setra.fr> References: <990017804.158478@edh3> <9du16o$fr3$1@nh.pace.co.uk> NNTP-Posting-Host: calamar.setra.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: setranews.setra.fr 990031439 20505 161.48.101.33 (16 May 2001 16:43:59 GMT) X-Complaints-To: usenet@setranews.setra.fr NNTP-Posting-Date: 16 May 2001 16:43:59 GMT X-Mailer: Mozilla 4.7 [fr] (WinNT; I) X-Accept-Language: fr Xref: archiver1.sj.google.com comp.lang.ada:7610 Date: 2001-05-16T16:43:59+00:00 List-Id: 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" 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.�