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,400766bdbcd86f7c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 17 Feb 2005 16:34:47 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1108139611.709714.36170@o13g2000cwo.googlegroups.com> <2IcPd.6268$mG6.1474@newsread1.news.pas.earthlink.net> <1108372232.436036.318690@g14g2000cwa.googlegroups.com> <1108456053.837461.20340@f14g2000cwb.googlegroups.com> <1bwQd.1171$kU3.57@newsread1.news.pas.earthlink.net> Subject: Re: This can't be done in Ada...or? Date: Thu, 17 Feb 2005 16:36:34 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-mqoSjCTNpS8OV/6eguoALznx62jyrobRKQ8FcRvuGoqu+a+GHpohCiXD9DMId++ja9lmJXaia302gY1!sZSzwvCX/GpeqaTqmpXyyIaz5V4b+CmMiN6afQg5rGOlbDVf9yuS1CW/qvvWiKT5Q26ZTmBnmS19 X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.31 Xref: g2news1.google.com comp.lang.ada:8394 Date: 2005-02-17T16:36:34-06:00 List-Id: "Jeffrey Carter" wrote in message news:1bwQd.1171$kU3.57@newsread1.news.pas.earthlink.net... ... > It's too late now, but this might have been a good thing to suggest for > Ada 0X. Compilers already have to have this information available, or > PragmARC.Reflection wouldn't work. We should be able to get at it > without all this overhead. It was suggested, as someone else noted. AI-282 was the result. It failed to go anywhere for a variety of reasons: there was no champion on the ARG (no one that wanted it badly enough to do the work needed); the proposal was too magic for the tastes of many members; at least one major compiler uses incremental compilation that would be destroyed by access to line numbers (which could change without any other significant change), so they opposed the package; exactly what the full subprogram name would be in a generic is unclear (the instance name or the template name?); we don't like code that changes its meaning if it is moved, and so on. I personally don't feel strongly, but I think it's unnecessary. And there would be a lot of space overhead whenever it is used (maybe that's not as important anymore, but Janus/Ada at least was designed around space minimization). Usually there is something better to report than the name of a subprogram. (I may be spoiled by the exception walkbacks built into the Janus/Ada runtime, which provides the information only when you actually need it -- to debug an unexpected exception.) One alternative to a lot of constants, especially for the package names, is to declare an enumeration type in your tracing package. For instance, from the Janus/Ada compiler: package J2Trace is type Unit_Names is (J2Type_Decs, J2CodeGen, J2Resolution, J2Symbol_Table,...); function Trace_Unit (Unit : in Unit_Names) return Boolean; procedure Elaboration_Trace (Unit : in Unit_Names); ... end J2Trace; Passing an enumeration has less overhead than passing a string (because there is no need to construct and pass the bounds), you can make sure that the names are spelled consistently, you can use the names for tracing control (as above with function Trace_Unit), and you can use Unit_Names'Image to display the unit when you need it. The main downside is that you have to update the tracing package when a new unit is added to the program, but that usually is a rare event. Randy Brukardt