comp.lang.ada
 help / color / mirror / Atom feed
From: Warren <ve3wwg@gmail.com>
Subject: Re: Inferring array index type from array object
Date: Tue, 29 Jun 2010 16:56:28 +0000 (UTC)
Date: 2010-06-29T16:56:28+00:00	[thread overview]
Message-ID: <Xns9DA683A562C67WarrensBlatherings@81.169.183.62> (raw)
In-Reply-To: 88sld2F9m8U1@mid.individual.net

Niklas Holsti expounded in news:88sld2F9m8U1@mid.individual.net:

> Warren wrote:
>> Niklas Holsti expounded in news:88f9osFmcmU1@mid.individual.net:
>>> Warren wrote:
>>>> Niklas Holsti expounded in news:88ec2vF3uqU1@mid.individual.net:
>>>>> Dmitry A. Kazakov wrote:
>>>>>> On Wed, 23 Jun 2010 00:30:23 -0700 (PDT), Maciej Sobczak wrote:
>>>> ..
>>>>>>> 2. Is it possible to declare the index variable without
>>>>>>> hardcoding the index type (that is, to infer it from the array
>>>>>>> object)? 
...
>>>>> same (sub)type as the loop counter in "for I in S'Range loop ...".
>>>> I think most would agree that this is a "convenience" feature.
>>> Yes, but in other contexts, when we advocate Ada, we often make a
>>> big point of the "convenience" of the 'Range attribute for arrays,
>>> such as "No need to pass extra parameters for array index bounds,
>>> just use 'Range". The suggestion to let variables be declared by the
>>> "type" S'Range (or, if desired, a new attribute S'Index_Type) has a
>>> similar advantage (but a weaker one, I admit).
...
>> At some point, you have to draw a line in the sand.
> 
> "Convenience" is not always opposed to "the Ada way". Ada strives to
> be readable and correctness-prone (that is, the opposite of
> error-prone). I thnk that there are features that could be added to
> Ada that favour these goals but also increase convenience.

No argument on that.

> I think Ada could well support an add-and-assign syntax, for example
> in the syntax X +:= 1 (or X := * + 1 as it was written IIRC in
> Burroughs 
..

One thing that really irks me (in lack of convenience)
is the lack of certain functions in the library support.  
For example, I was looking for the inverse of a complex 
number function. Did I missed it? My googling didn't 
turn up much, nor did grep on the package hdrs.

So because it is missing (AFIK), I had to google it and 
figure out how it is done and code it myself.  Wouldn't it
be safer if the function was already provided and tested?
Wouldn't it also be more accurately coded (floating
point can be tricky)? At least it would be tested.

IIRC, I ran into the similar issues with some other
functions (ATAN2??). The LOG10() issue was
resolved when I discovered there is a base argument
in LOG(), so that was just my own "user error".

But even if a function is considered "trivial", I
think it would be "safer" to include it. Additionally, 
having them provided means that they will 
be coded for the best accuracy.

Warren



  parent reply	other threads:[~2010-06-29 16:56 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23  7:30 Inferring array index type from array object Maciej Sobczak
2010-06-23  8:01 ` Dmitry A. Kazakov
2010-06-23  9:03   ` J-P. Rosen
2010-06-23 12:24     ` Georg Bauhaus
2010-06-23 12:52       ` J-P. Rosen
2010-06-23 19:09         ` Simon Wright
2010-06-24  7:25           ` Georg Bauhaus
2010-06-23 14:38     ` Robert A Duff
2010-06-23 15:17       ` J-P. Rosen
2010-06-23 17:17         ` Robert A Duff
2010-06-24  6:16           ` J-P. Rosen
2010-06-23 12:13   ` Niklas Holsti
2010-06-23 14:27     ` Peter C. Chapin
2010-06-23 20:24       ` Niklas Holsti
2010-06-23 16:33     ` Warren
2010-06-23 17:49       ` Dmitry A. Kazakov
2010-06-23 18:45         ` Warren
2010-06-23 20:39       ` Niklas Holsti
2010-06-28 13:44         ` Warren
2010-06-28 22:18           ` Niklas Holsti
2010-06-29  1:49             ` Adam Beneschan
2010-06-29  2:10               ` (see below)
2010-06-29 16:56             ` Warren [this message]
2010-06-29 17:50               ` John B. Matthews
2010-06-29 19:31                 ` Warren
2010-06-29 20:06                   ` Jeffrey R. Carter
2010-06-29 20:16                     ` Warren
2010-06-29 20:22                   ` Adam Beneschan
2010-06-29 20:39                     ` Dmitry A. Kazakov
2010-06-29 20:55                     ` Warren
2010-06-29 21:00                       ` Warren
2010-06-29 21:47                         ` John B. Matthews
2010-06-29 21:52                         ` Damien Carbonne
2010-06-29 22:22                         ` Adam Beneschan
2010-06-30 16:43                           ` Warren
2010-06-29 21:18                       ` Jeffrey R. Carter
2010-06-30  5:01                     ` Simon Wright
2010-06-30 14:29                       ` Adam Beneschan
2010-06-29 20:28                   ` Damien Carbonne
2010-06-29 21:20                   ` John B. Matthews
2010-06-23 13:12 ` Gautier write-only
replies disabled

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