comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Parameterised 'Image Attributes
Date: Sat, 19 Aug 2023 15:01:36 +0200	[thread overview]
Message-ID: <ubqeff$ni22$1@dont-email.me> (raw)
In-Reply-To: <ubqako$pla9$1@dont-email.me>

On 2023-08-19 13:56, J-P. Rosen wrote:
> Le 19/08/2023 à 12:03, Dmitry A. Kazakov a écrit :
>> On 2023-08-19 11:14, J-P. Rosen wrote:
>>
>>> The intent of the 'Image attribute is to have a quick representation, 
>>> mainly for debugging purposes.
>>
>> It seems that for the vast majority of Ada users this intent was wrong...
> The vast majority of Ada users ignore a number of useful features 
> provided by the language, and keep asking for improvements that are 
> already there...

Or these features are not that useful? Language users and designers have 
often different perspectives...

>>> If you want nice formatted output, use the Put procedure on String 
>>> from Text_IO.
>>
>> Put does not supersede 'Image. Put is I/O. 'Image is pure string 
>> formatting. Put is generic and requires instantiation of some package 
>> with some difficult to guess name. 'Image is built-in [statically] 
>> dispatching and generated automatically by the compiler.
>>
> Yes, put has nothing to do with 'Image. Yes, put requires instantiation. 
> So what? Ada is more verbose, in favor of stricter typing.

I don't see how instantiation is stricter typing. In fact instantiation 
introduces overloading (static ad-hoc polymorphism) which was always 
frowned upon at as less type safe than overriding.

> Ease of 
> reading over ease of writing has always been a major design principle of 
> Ada - although I confess it had a bad effect on its popularity, people 
> want to write fast and ignore long term maintenance issues.

I don't buy this either. It is

    Put (X)  vs. X'Image

equally readable and writable. If you refer to the instantiation noise 
or with/use clauses you would require to but somewhere far above in the 
package. That is not ease of reading. That is just meaningless noise.

> If you want formatting on an integer type (with or without IO), you 
> instantiate Integer_IO. I don't find it hard to guess the name... Maybe 
> you had something else in mind?

Yes, all other types that might require formatting. I doubt anybody, but 
a language lawyer could name the package appropriate for formatting a 
fixed-point type without looking into the RM. Which is absolutely 
unneeded as 'Image would be perfectly OK if it had necessary parameters. 
All that generic text I/O packages are unnecessary as stream I/O case 
perfectly illustrates. Ada 95 did stream I/O if not right, but far 
better making 'Read, 'Write etc attributes overridable. The problem of 
generic mess solved. We do not have and do not need any generics for 
stream I/O. Good riddance.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2023-08-19 13:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18  7:18 Parameterised 'Image Attributes Rod Kay
2023-08-18  8:25 ` Luke A. Guest
2023-08-19  9:14   ` J-P. Rosen
2023-08-19 10:03     ` Dmitry A. Kazakov
2023-08-19 11:45       ` Luke A. Guest
2023-08-19 11:56       ` J-P. Rosen
2023-08-19 13:01         ` Dmitry A. Kazakov [this message]
2023-08-19 15:27     ` Jeffrey R.Carter
2023-08-20  7:53       ` G.B.
2023-08-20  9:27         ` Dmitry A. Kazakov
2023-08-21 23:11           ` Randy Brukardt
2023-08-21 23:37           ` Randy Brukardt
2023-08-22  7:38             ` Dmitry A. Kazakov
2023-08-19 16:49     ` moi
2023-08-20  7:25       ` Randy Brukardt
2023-08-20  9:43         ` Dmitry A. Kazakov
2023-08-21 23:34           ` Randy Brukardt
2023-08-22  8:13             ` Dmitry A. Kazakov
2023-08-23 10:20               ` Stephen Davies
2023-08-23 16:16                 ` Dmitry A. Kazakov
2023-08-24 19:59                   ` Stephen Davies
2023-08-25  7:26                     ` Dmitry A. Kazakov
2023-08-25  9:04                       ` Stephen Davies
2023-08-25 13:02                         ` Dmitry A. Kazakov
2023-08-28  9:18                           ` Stephen Davies
2023-08-28 10:58                             ` Dmitry A. Kazakov
2023-08-28 15:42                               ` Stephen Davies
2023-08-28 16:09                                 ` Dmitry A. Kazakov
2023-08-28 17:33                                   ` G.B.
2023-08-28 19:08                                     ` Dmitry A. Kazakov
2023-08-28 17:58                               ` Niklas Holsti
2023-08-28 19:08                                 ` Dmitry A. Kazakov
2023-09-07  1:04                               ` Randy Brukardt
2023-09-07  9:01                                 ` Dmitry A. Kazakov
2023-08-18 18:53 ` Keith Thompson
2023-09-23 10:00 ` Rod Kay
2023-09-26  5:47   ` Vadim Godunko
2023-09-26 10:15     ` Rod Kay
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox