Prev: Question about default discriminants and mutable objects.
Next: Why is not Stream_Access defined Ada.Streams ?
From: Robert A Duff on 7 May 2010 16:33
"Yannick Duch�ne (Hibou57)" <yannick_duchene(a)yahoo.fr> writes:
> Le Fri, 07 May 2010 15:37:55 +0200, Georg Bauhaus
> <rm.dash-bauhaus(a)futureapps.de> a �crit:
>> Put (Num_Errors);
>> Put_Line (" errors detected.");
> Here is, that's also my preferred way to do to output execution logs.
> That's not so much annoying, while this is a written-once-used-many-times.
Well, that "Put (Num_Errors);" is hiding something. You have to
instantiate Text_IO.Integer_IO for all the integer types you
need to output. That's annoying.
From: Robert A Duff on 7 May 2010 16:41
"Yannick Duchêne (Hibou57)" <yannick_duchene(a)yahoo.fr> writes:
> Le Fri, 07 May 2010 21:56:19 +0200, J-P. Rosen <rosen(a)adalog.fr> a écrit:
>>>> '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.
> Is there an existing list somewhere compiling this kind of “tiny” errors
> in the standard's choices ?
I have such a list -- in my head. ;-)
Sorry, there's no room in the margin of this document to list them
all, so I'll just mention one: lack of zero-element and one-element
positional array aggregates. Not a big problem, just a minor
And I also have such lists in my head for many other
programming languages. ;-)
From: Georg Bauhaus on 7 May 2010 15:44
Robert A Duff wrote:
> 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.
This move towards expressions is not one of SPARK?
Lifting expressions into the rank of named entities
will inevitably give way to the temptation of not saying
(naming) what you mean. (Like anonymous access is reportedly
doing already in all sorts of places, giving rise
to another naming lasso, 'Ref IIRC.)
If this move favors placing the semantically first part of an
expression last, at the end, in the "by the way" position,
will Ada at last become a writer's favorite?
- ((71)'Val & 'e' & TLD (3221233671))'Img
From: Yannick Duchêne (Hibou57) on 7 May 2010 16:51
Le Fri, 07 May 2010 22:31:47 +0200, Robert A Duff
<bobduff(a)shell01.theworld.com> a Ã©crit:
> Note that I said "beginners", not "students".
> A beginner needs to learn how to write a "Hello, world" program
> first, and soon thereafter, some simple thing that involves
> printing out integer values. I think one of my first assignments
> way back when was to write a program to add up two numbers
> and print out the answer. If that's hard, it gives a bad
> first impression. (In fact, it WAS hard -- it involved
> horsing around with Fortran FORMAT statements and Hollerith codes,
> which is worse than horsing around with Ada generics.)
> Yes, Ada students need to learn about generics -- eventually,
> not in the first week of class. There's just no way a
> beginning programmer can understand generics in the first week.
> Simple things should be simple.
So (especially if you're a teacher), just provide them a package with
useful stuffs of the like. This is how I first switched from a Pascal
dialect to Ada 95 : I could understand somethings, found it was not so
much easy at first glance, but still could create a package with
functionalities inspired from what's provided with typical Pascal program
; then later just dropped this.
The pending question may be now : when should students or beginners be
able to understand the concept of using an âexternalâ component ? Perhaps
they should not start typing anything prior to that, and should start
learning, at the very beginning, listening someone recounting them nice
and happy stories involving basic abstraction principles :)
No-no, this isn't an oops ...or I hope (TM) - Don't blame me... I'm just
From: Robert A Duff on 7 May 2010 16:53
Georg Bauhaus <see.reply.to(a)maps.futureapps.de> writes:
> If this move favors placing the semantically first part of an
> expression last, at the end, in the "by the way" position,
> will Ada at last become a writer's favorite?
> - ((71)'Val & 'e' & TLD (3221233671))'Img
Well, that's a good point. I guess I agree
that Image(...) is more readable than (...).Image
or something like that.