From: Keith Thompson on
"Randy Brukardt" <randy(a)rrsoftware.com> writes:
> "Adam Beneschan" <adam(a)irvine.com> wrote in message
> news:2318cabb-080c-42a0-8219-21c347abe172(a)o11g2000yqj.googlegroups.com...
> On May 6, 10:10 am, Warren <ve3...(a)gmail.com> wrote:
> ...
>>Broadly, you can't use a FOR attribute specification on every
>>attribute, just a few select ones that the language specifically says
>>you can. 'Image isn't one of those.
>>
>>I think it's been mentioned a few times on this newsgroup that it
>>might be nice to have this ability, but I don't see that anyone has
>>submitted an actual language change proposal.
>
> I believe we looked at it semi-seriously back during the Ada 2005, but we
> ran into some problems (I don't recall the details - might have been
> visibility) and decided it wasn't worth the headache.
>
> It would probably be possible with some work.

The interaction with 'Value and 'Width, and with the Wide_ and
Wide_Wide_ variants of all three attributes, would be ... interesting.

--
Keith Thompson (The_Other_Keith) kst-u(a)mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
From: Simon Wright on
Stephen Leake <stephen_leake(a)stephe-leake.org> writes:

> "Dmitry A. Kazakov" <mailbox(a)dmitry-kazakov.de> writes:

>> So, T'Image has some minor advantages. (The argument would really work
>> if it were V'Image or V.Image)
>
> It's Foo.Bar.T'Image vs Foo.Bar.Images.Image. No problem.

I know it's an implementation-defined attribute, but for non-operational
quick-and-dirty code that doesn't need to be portable I use GNAT's V'Img
(shame it still has the leading space for positive numbers!)

Sometimes the 'Image way is useful even in that sort of context:
Duration'Image (Finish_Time - Start_Time)
avoids the need for a local variable which 'Img would require.
From: J-P. Rosen on
Robert A Duff a �crit :
> "J-P. Rosen" <rosen(a)adalog.fr> writes:
>
>> Robert A Duff a �crit :
>>> But for "columns" you want something like:
>>>
>>> 1
>>> -3
>>> 123
>>> -123
>>>
>>> But 'Image gives you:
>>>
>>> 1
>>> -3
>>> 123
>>> -123
>>>
>>> I don't get it. 'Image isn't particularly helpful in producing
>>> columnar output.
>>
>> 'Image is just for quick, debug-like output.
>
> So that's why it's broken?!
I was just responding that 'Image is not for columns, and of course I
agree that the extra space was a mistake - just like making Priority a
subtype of Integer.
--
---------------------------------------------------------
J-P. Rosen (rosen(a)adalog.fr)
Visit Adalog's web site at http://www.adalog.fr
From: Robert A Duff on
Simon Wright <simon(a)pushface.org> writes:

> Sometimes the 'Image way is useful even in that sort of context:
> Duration'Image (Finish_Time - Start_Time)
> avoids the need for a local variable which 'Img would require.

By the way, I think this:

Put_Line (Duration'(Finish_Time - Start_Time)'Img);

will be legal in Ada 2012. Well, the 'Img is still a
GNAT-specific thing, but I'm talking about the ability to
use a qualified expression as the prefix of an attribute.

Now why isn't this:

Put_Line ((Finish_Time - Start_Time)'Img);

legal? I don't know, but the language is moving in
that direction -- maybe by 2099, the syntactic distinction between
expression and name (and the semantic distinction between
value and object) will disappear entirely.

- Bob
From: Robert A Duff on
"J-P. Rosen" <rosen(a)adalog.fr> writes:

> Robert A Duff a �crit :
>> So that's why it's broken?!
> I was just responding that 'Image is not for columns, and of course I
> agree that the extra space was a mistake

Oh, OK, then we agree. That was my point, too: 'Image is not for
columns, so "for columns" can't explain the extra blank.

>... - just like making Priority a
> subtype of Integer.

I agree, but students won't run into that one in the
first week of the beginner's class.

First impressions matter.

- Bob