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: a07f3367d7,5b031d156719dbc9 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!news.astraweb.com!border3.a.newsrouter.astraweb.com!newsfeed-hp3.netcologne.de!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 28 May 2009 11:53:29 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: 'Image for composite types References: <45845c4b-58f4-4848-8d5e-2ab58133c250@d38g2000prn.googlegroups.com> In-Reply-To: <45845c4b-58f4-4848-8d5e-2ab58133c250@d38g2000prn.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4a1e5f19$0$32678$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 28 May 2009 11:53:29 CEST NNTP-Posting-Host: 65da1e76.newsspool2.arcor-online.net X-Trace: DXC=Bl4\\iDL2=G=8m7nZkdN^@A9EHlD;3YcB4Fo<]lROoRA^YC2XCjHcbI0DWemF[LilL;9OJDO8_SKFNSZ1n^B98iJ4nHA:;Z@W7C X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:6059 Date: 2009-05-28T11:53:29+02:00 List-Id: Adam Beneschan schrieb: > On May 27, 3:20 pm, Martin 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;