From: Yannick Duchêne (Hibou57) on
Le Fri, 07 May 2010 19:38:12 +0200, Dmitry A. Kazakov
<mailbox(a)dmitry-kazakov.de> a écrit:
> Polymorphism. Genericity is a kind of polymorphism (static), but not all
> polymorphism is genericity.
You're right Dmitry, I miss-used the word “generic” here.. Happy to read
this re-rewording ;)

> If you consider image statically polymorphic,
> then it is more the C++ way than the Ada's one. Compare:
>
> T'Image(X) image<T>(x)
I could not tell anything about this, as I've forgotten too much about C++
(and especially concerning area).


--
No-no, this isn't an oops ...or I hope (TM) - Don't blame me... I'm just
not lucky
From: Yannick Duchêne (Hibou57) on
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 ?

--
No-no, this isn't an oops ...or I hope (TM) - Don't blame me... I'm just
not lucky
From: Robert A Duff on
"Yannick Duch�ne (Hibou57)" <yannick_duchene(a)yahoo.fr> writes:

> Le Fri, 07 May 2010 14:27:35 +0200, Robert A Duff
> <bobduff(a)shell01.theworld.com> a �crit:
>
>> "Randy Brukardt" <randy(a)rrsoftware.com> writes:
>>
>>> I actually don't buy the need for the Assert pragma in the first
>>> place: such
>>> checks are rarely expensive and thus should simply be part of the code
>>> always.
>>
>> If they're not expensive, then you're not using it enough. ;-)
> Hihi, nice
>
>> Also, the other advantage of pragma Assert over an Assert
>> procedure is that you can put the pragma in declarative parts
>> and package specs.
> That's what I like to do too : define Assert pragmas in package spec,
> ...

Then you will probably like some of the new proposals for Ada 2012 --
take a look at preconditions, postconditions, subtype predicates,
and type invariants.

I am particularly fond of subtype predicates, but I'm afraid
many ARG members do not (yet?!) agree with me on that.

GNAT's pragmas Compile_Time_Error and Compile_Time_Warning
can also be useful in this general area.

- Bob
From: Jeffrey R. Carter on
Yannick Duchêne (Hibou57) wrote:
> I could not tell anything about this, as I've forgotten too much about
> C++ (and especially concerning area).

You can never forget too much about C++.

--
Jeff Carter
"Oh Lord, bless this thy hand grenade, that with it thou
mayst blow thine enemies to tiny bits, in thy mercy."
Monty Python and the Holy Grail
24
From: Robert A Duff on
"Yannick Duch�ne (Hibou57)" <yannick_duchene(a)yahoo.fr> writes:

> Le Fri, 07 May 2010 16:25:37 +0200, Robert A Duff
> <bobduff(a)shell01.theworld.com> a �crit:
>> And teaching beginners how to instantiate generics,
>> when there's a simple 'Image feature, is not a good idea.
> Mhhhh... don't agree.

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.)

>... 'Image is a kind of hidden genericity, and
> students would get more benefit in learning the explicit one.

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.

> Forgive me for these wording I don't like : starting to have heavy
> requirement on the 'Image attribute would be the start of bloating and
> the start of Ada as a library instead of Ada as a language and as a
> design language..

I disagree. Certainly removing the extra blank would not introduce
bloat. And in fact, giving 'Image the exact same functionality
as Integer_Text_IO would _simplify_ the language, by making
it more uniform.

- Bob