comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: 'Image for composite types
Date: Thu, 28 May 2009 11:53:29 +0200
Date: 2009-05-28T11:53:29+02:00	[thread overview]
Message-ID: <4a1e5f19$0$32678$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <45845c4b-58f4-4848-8d5e-2ab58133c250@d38g2000prn.googlegroups.com>

Adam Beneschan schrieb:
> On May 27, 3:20 pm, Martin <martin.do...@btopenworld.com> wrote:
>> Is it just me that gets fed up with the lack of 'Image on composite
>> types?
>>
>> I'm thinking in particular of when I'm testing / debugging and usually
>> end up writing lots of 'Put_Line' code for each and every record. And
>> then having to maintain them.


> A lot more thought would have to go into this to make it a real
> language feature.

Maybe a simple standardized package will do, as follows.
Alluding to SNOBOL-4's &TRACE mechanism, Perl's
Data::Dumper, (SML/NJ compiler access in user programs?),
and ASIS:  Since an Ada compiler knows the internal represenation
for every type, it can instantiate a simple tracing procedure.

This assumes that a stupid implementation defined subprogram
is enough for testing / debugging.

package Mypack is

   type T is private;

private

   type T is record
      U: Unbounded_String;
      T: Time;
   end record;

   pragma Convention(ASIS, T);
	-- if it is necessary to annouce this to
	-- the compiler for tracing

end Mypack;



with Compiler; -- a portable/language defined spec
with Mylog;    -- here is where I want the data images

pragma Tracing (On);

package body Mypack is

   procedure Put_T is
      new Compiler.Trace (Data => T,
                          Stream => Mylog.Stderr);

end Mypack;




  parent reply	other threads:[~2009-05-28  9:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-27 22:20 'Image for composite types Martin
2009-05-27 23:23 ` Robert A Duff
2009-05-27 23:44 ` Adam Beneschan
2009-05-28  6:46   ` Martin
2009-05-28  9:53   ` Georg Bauhaus [this message]
2009-05-28 10:42     ` Martin
2009-05-28 11:31       ` Georg Bauhaus
2009-05-28 16:25       ` Jeffrey R. Carter
2009-05-28 16:47         ` Martin
2009-05-28  3:36 ` Per Sandberg
2009-05-28  5:15   ` tmoran
2009-06-06  9:17   ` Martin
2009-05-28  9:13 ` Dmitry A. Kazakov
2009-05-31 12:17 ` Stephen Leake
2009-06-06  9:17   ` Martin
replies disabled

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