comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: This can't be done in Ada...or?
Date: Thu, 17 Feb 2005 16:36:34 -0600
Date: 2005-02-17T16:36:34-06:00	[thread overview]
Message-ID: <IeWdncdSt_GagYjfRVn-hQ@megapath.net> (raw)
In-Reply-To: 1bwQd.1171$kU3.57@newsread1.news.pas.earthlink.net


"Jeffrey Carter" <spam@spam.com> 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







  parent reply	other threads:[~2005-02-17 22:36 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11 16:33 This can't be done in Ada...or? Per Lindquist
2005-02-11 16:51 ` Duncan Sands
2005-02-12 19:55   ` Florian Weimer
2005-02-14  8:34     ` Per Lindquist
2005-02-14  8:17   ` Per Lindquist
2005-02-11 17:02 ` Jeff C
2005-02-11 18:27   ` Robert A Duff
2005-02-11 23:51     ` Ludovic Brenta
2005-02-11 23:52       ` Robert A Duff
2005-02-12 13:55     ` Duncan Sands
2005-02-12 14:58       ` Martin Krischik
2005-02-12 15:56         ` Martin Dowie
2005-02-12 19:02       ` Robert A Duff
2005-02-14  8:49     ` Per Lindquist
2005-02-11 17:08 ` Jerome Hugues
2005-02-14  9:05   ` Per Lindquist
2005-02-14 13:07     ` Georg Bauhaus
2005-02-12  1:10 ` Jeffrey Carter
2005-02-12 14:01   ` Duncan Sands
2005-02-13  0:27     ` Jeffrey Carter
2005-02-14  9:10       ` Per Lindquist
2005-02-15  0:40         ` Jeffrey Carter
2005-02-15  7:40           ` Per Lindquist
2005-02-15  8:39             ` OT: Google reply (Was: Re: This can't be done in Ada...or?) Adrien Plisson
2005-02-15  9:42               ` Per Lindquist
2005-02-15  8:27           ` This can't be done in Ada...or? Per Lindquist
2005-02-14 22:10             ` Manuel G. R.
2005-02-15  8:47             ` Mark Lorenzen
2005-02-15  9:09               ` Jacob Sparre Andersen
2005-02-15  9:31                 ` Mark Lorenzen
2005-02-15  9:48                   ` Jacob Sparre Andersen
2005-02-15 10:07                     ` Mark Lorenzen
2005-02-15 10:15                   ` Martin Dowie
2005-02-17 22:09                     ` Randy Brukardt
2005-02-18  6:53                       ` Martin Dowie
2005-02-15 13:46                   ` Robert A Duff
2005-02-15 13:41                 ` Robert A Duff
2005-02-15 16:30                   ` Per Lindquist
2005-02-15 19:38                     ` Martin Dowie
2005-02-15 20:20                     ` Robert A Duff
2005-02-17 21:52                   ` Simon Wright
2005-02-17 22:06               ` Randy Brukardt
2005-02-17 22:40                 ` Mark Lorenzen
2005-02-16  0:04             ` Jeffrey Carter
2005-02-16  0:09             ` Jeffrey Carter
2005-02-17  9:47               ` Per Lindquist
2005-02-17 22:36               ` Randy Brukardt [this message]
2005-02-14 15:21 ` Peter Amey
replies disabled

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