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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1e08410099d337f8 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!newsfeed.stueberl.de!newsfeed.vmunix.org!newsfeed.hanau.net!news-fra1.dfn.de!news.tele.dk!not-for-mail Sender: malo@0x5358ef74.boanxx18.adsl-dhcp.tele.dk Newsgroups: comp.lang.ada Subject: Re: creating own Image function References: <1104339103.436794.134250@f14g2000cwb.googlegroups.com> From: Mark Lorenzen Date: 29 Dec 2004 21:56:12 +0100 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: TDC Totalloesninger NNTP-Posting-Host: 83.88.239.116 X-Trace: 1104353773 dtext02.news.tele.dk 159 83.88.239.116:47462 X-Complaints-To: abuse@post.tele.dk Xref: g2news1.google.com comp.lang.ada:7308 Date: 2004-12-29T21:56:12+01:00 List-Id: "Luke A. Guest" writes: > On Wed, 29 Dec 2004 18:04:08 +0100, Mark Lorenzen wrote: > > > "R" writes: > > > >> Hello. > >> > >> I've written my own Image function it's sth like Java's toString. > >> > >> function Image(this: rec1) return String is > >> tmp : String(1..26); > >> begin > >> tmp := "The value of field is:" & Integer'Image(Get(this)); > >> return tmp; > >> end Image; > > > > Your questions are really newbee questions and I recommend that you > > read a book about Ada in order to get it right from the beginning and > > not take your knowledge of other languages into "Ada world". > > Hmmm, a bit too harsh, me thinks. Obviously, just correcting it like you > did would've been enough. It wasn't my intention to be harsh. I just think that trying to program small examples and then post them to c.l.a in order to get them corrected, is not the best way to learn Ada or other programming languages. Just like there is a C++ way to do things in C++ there is an Ada way to do things in Ada. It is important to learn the Ada way of thinking in order to really use the language in an effective way. Otherwise the OP will just try to write C++ programs in Ada and think that Ada sucks because it is darn hard (and ugly) to write C++ programs in Ada. > > Although, he does have a good point (kind of), about creating your own > image functions, I would prefer it if you could provide an Image function > for a type and have T'Image call that function. That would be a really > nice addition to the language. > > Luke. - Mark Lorenzen