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 Path: g2news2.google.com!postnews.google.com!t21g2000yqi.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: 'Image for composite types Date: Wed, 27 May 2009 23:46:53 -0700 (PDT) Organization: http://groups.google.com Message-ID: <50e68e9b-c987-4876-8495-ad6dffe51274@t21g2000yqi.googlegroups.com> References: <45845c4b-58f4-4848-8d5e-2ab58133c250@d38g2000prn.googlegroups.com> NNTP-Posting-Host: 81.154.95.136 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1243493214 19710 127.0.0.1 (28 May 2009 06:46:54 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 28 May 2009 06:46:54 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t21g2000yqi.googlegroups.com; posting-host=81.154.95.136; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10, Ant.com Toolbar 1.3,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6053 Date: 2009-05-27T23:46:53-07:00 List-Id: Adam, Thanks for the comments so far...hopefully there are answers to them that satisfy... On May 28, 12:44=A0am, Adam Beneschan wrote: [snip] > This wouldn't work on variant records. Could add these as well? function record_type_definition'Discriminant_Name (I : Positive) return String; function record_type_definition'Discriminant_Image (I : Positive) return String; function record_type_definition'Number_Of_Discriminants return Natural; For 'plain' records 'Number_Of_Discriminants would return 0. >=A0Plus, what does > 'Component_Image return if the component type is itself another > record, or an array, or a task? =A0Or an access? Then it would call the 'Image for that component - in the same way as for Integer or Float etc. > Plus, in your example below, one of your components is an > Unbounded_String, which is a private type most likely implemented as a > record or access type. =A0What language rule would make 'Component_Image > of that type return the string value, while 'Component_Image of other > records or access types would do something more pedestrian? In this new extension I'm imagining that all records have at least a compiler generated 'Image (which the user can override) with: type My_Record is private; private; fnunction To_String (R : My_Record) return String; for My_Record'Image use To_String; For access types, if I'm writing these by hand, I'd return string "null" or call the 'Image for the component if it isn't null. > A lot more thought would have to go into this to make it a real > language feature. Absolutely! That's why I'm floating the idea here rather than on Ada- Comment. >=A0Others may have opinions on whether the amount of > effort required to design this feature well, combined with the amount > of effort required for compiler vendors to implement it, is justified > by the benefits. Very true. But I'm pleased to see at least 1 ARG member publicly acknowledging the problem, if not my proposed solution. Cheers -- Martin