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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f868292008c639ce X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: C vs. Ada - strings Date: 2000/05/22 Message-ID: #1/1 X-Deja-AN: 625867213 Sender: bobduff@world.std.com (Robert A Duff) References: <390F0D93.F835FAD9@ftw.rsc.raytheon.com> <8en5o9$ihe$1@nnrp1.deja.com> <8eonos$e70$1@wanadoo.fr> <1fIU4.4668$Rx3.250161@typhoon.nyroc.rr.com> <8g8p31$a2s$1@nnrp1.deja.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-05-22T00:00:00+00:00 List-Id: Robert Dewar writes: > In article , > Robert A Duff wrote: > > So is the verbose > > syntax. Why can't you say X'Image instead of > Integer'Image(X)? > > Note that GNAT provides the attribute Img, which can be used > precisely in this manner (e.g. X'Img instead of > Integer'Image (X)). Very useful for simple debug output Yes, of course, I anticipated that you would mention GNAT's 'Img -- to the point where I have already written a reply in my head. ;-) Of course the main drawback is that 'Img is not standard. If you don't care about that, then 'Img is fine. My other (minor) complaint is that Img is an ugly abbreviation for Image. Robert will reply that it's standard Ada style to use abbreviations for attribute names. And I will reply that that's true, but it's not standard Ada style to use *ugly* abbreviations for attribute names. ;-) I'm not allergic to abbreviations for commonly used things: 'Pred is OK because (1) there's precedent (from Pascal) so folks are used to it, (2) it's a prefix, (3) it's pronouncable, (4) it's unlikely to cause confusion, and (5) there's a high payoff in terms of how much less code you have to read ("Pred" vs "Predecessor"). 'Img, on the other hand, abbreviates by leaving out all the vowels, something which I find uncivilized, compared to using a prefix of the word. And it only saves two letters. Of course, GNAT has no choice -- it would be illegal to call it 'Image, and 'Img is the obvious alternative. Oh, one other thing: 'Img, being a GNAT invention, *could* have eliminated the annoying extra blank. Why didn't you? - Bob