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,c689b55786a9f2bd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: for S'Image use Func?? References: <2318cabb-080c-42a0-8219-21c347abe172@o11g2000yqj.googlegroups.com> Date: Sat, 08 May 2010 01:26:23 -0400 Message-ID: <82y6fvklq8.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt) Cancel-Lock: sha1:j1qDsK1nHStU/Z602zXco9L425o= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: baae84be4f653e197caa718707 Xref: g2news2.google.com comp.lang.ada:11410 Date: 2010-05-08T01:26:23-04:00 List-Id: stefan-lucks@see-the.signature writes: > On Thu, 6 May 2010, Warren wrote: > >> I'm just being a typical lazy programmer (not always >> wanting to lookup the correct package prefix for >> the To_String() function to use). > > How about overloading the &-operator: > > function "&"(S: String; Item: T) return String; > > if X is of type T and you "use type T", you can replace the expression > > T'Image(X) > > by > > "" & X > > If your T'Image(X) is part of a larger string expression, overloading & > appears to be very convenient (for the "typical lazy programmer", as you > put it): > > Ada.Text_IO.Put_Line("The first result is " & X & > " the second result is " & Y & "."); +1 -- -- Stephe