From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada.Locales pseudo-string types
Date: Wed, 08 Aug 2012 17:01:23 +0300
Date: 2012-08-08T17:01:23+03:00 [thread overview]
Message-ID: <a8f9pjF9htU1@mid.individual.net> (raw)
In-Reply-To: <8zenu4qplfb$.1uc9oi1819c3v$.dlg@40tude.net>
On 12-08-08 14:59 , Dmitry A. Kazakov wrote:
> On Wed, 08 Aug 2012 14:14:26 +0300, Niklas Holsti wrote:
>
>> On 12-08-08 11:09 , Dmitry A. Kazakov wrote:
>>> On Wed, 08 Aug 2012 10:37:51 +0300, Niklas Holsti wrote:
>>>
>>>> On 12-08-08 10:18 , Dmitry A. Kazakov wrote:
>>>>> On Wed, 08 Aug 2012 10:04:37 +0300, Niklas Holsti wrote:
>>>>>
>>>>>> The rule does seem surprisingly rigid, for a value conversion. (The
>>>>>> Annotated RM does not explain or motivate it.)
>>>>>
>>>>> Ada didn't appreciate structured type equivalence in earlier times. These
>>>>> rules were designed before anonymous access types crept in.
>>>>
>>>> But we are talking about explicitly requested type conversions, not
>>>> implicit type equivalence. As I understood it, at least.
>>>
>>> Yes, but the validity of this conversion relies on an inferred equivalence
>>> of the [sub]types of the elements.
>>
>> No, I would rather think that the explicitly requested array-type
>> conversion implies requests to convert the index [sub]types and the
>> element [sub]types, too.
>
> Yes, but the way this conversion is constructed is based on the assumption
> that subtypes of the element are equivalent up to a conversion.
>
> BTW, if you go that far you should also allow conversions between any array
> types of convertible elements. E.g. between arrays of floats and arrays of
> integers etc.
Well, for explicit value conversions, why not? But I don't think that
there is significant need for such conversions on the array level.
What I have sometimes found annoying is that operations on arrays of a
parent type cannot easily be applied to arrays of a derived type. For
example:
type Parent is (A, B, C);
type Parent_Arr is array (Positive range <>) of Parent;
procedure Print (Item : in Parent_Arr)
...
end Print;
type Child is new Parent;
type Child_Arr is array (Positive range <>) of Child;
The operation Print on Parent_Arr is not inherited by Child_Arr, and
conversion from Child_Arr to Parent_Arr is not allowed. Not a big
problem, but one that has sometimes irritated me and forced me to use
work-arounds (writing a special Print for Child_Arr, in this case).
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2012-08-13 8:47 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 16:45 Ada.Locales pseudo-string types Marius Amado-Alves
2012-08-06 17:10 ` Marius Amado-Alves
2012-08-06 19:15 ` J-P. Rosen
2012-08-06 19:34 ` Simon Wright
2012-08-06 20:07 ` Marius Amado-Alves
2012-08-06 20:57 ` Simon Wright
2012-08-06 21:09 ` Vasiliy Molostov
2012-08-06 23:07 ` Adam Beneschan
2012-08-06 23:23 ` Vasiliy Molostov
2012-08-06 23:46 ` Adam Beneschan
2012-08-07 1:17 ` Vasiliy Molostov
2012-08-07 7:20 ` Dmitry A. Kazakov
2012-08-07 7:43 ` Jacob Sparre Andersen
2012-08-09 20:47 ` Randy Brukardt
2012-08-07 8:44 ` Marius Amado-Alves
2012-08-07 13:14 ` Marius Amado-Alves
2012-08-07 15:42 ` Adam Beneschan
2012-08-07 18:22 ` Marius Amado-Alves
2012-08-07 20:10 ` Adam Beneschan
2012-08-07 20:42 ` Marius Amado-Alves
2012-08-07 21:38 ` Adam Beneschan
2012-08-08 7:04 ` Niklas Holsti
2012-08-08 7:18 ` Dmitry A. Kazakov
2012-08-08 7:37 ` Niklas Holsti
2012-08-08 8:09 ` Dmitry A. Kazakov
2012-08-08 11:14 ` Niklas Holsti
2012-08-08 11:59 ` Dmitry A. Kazakov
2012-08-08 14:01 ` Niklas Holsti [this message]
2012-08-09 7:48 ` Dmitry A. Kazakov
2012-08-09 8:31 ` Niklas Holsti
2012-08-09 12:17 ` Dmitry A. Kazakov
2012-08-09 15:25 ` Niklas Holsti
2012-08-09 16:43 ` Dmitry A. Kazakov
2012-08-08 8:28 ` J-P. Rosen
2012-08-08 11:35 ` Niklas Holsti
2012-08-08 14:05 ` Georg Bauhaus
2012-08-08 7:32 ` J-P. Rosen
2012-08-08 8:17 ` Niklas Holsti
2012-08-08 8:33 ` J-P. Rosen
2012-08-08 11:44 ` Niklas Holsti
2012-08-09 21:00 ` Randy Brukardt
2012-08-08 8:35 ` Dmitry A. Kazakov
2012-08-08 9:32 ` Marius Amado-Alves
2012-08-08 10:11 ` Dmitry A. Kazakov
2012-08-08 11:28 ` Marius Amado-Alves
2012-08-08 11:30 ` Marius Amado-Alves
2012-08-08 11:35 ` Marius Amado-Alves
2012-08-08 12:24 ` Dmitry A. Kazakov
2012-08-08 11:52 ` Niklas Holsti
2012-08-08 13:21 ` Dmitry A. Kazakov
2012-08-08 9:07 ` Marius Amado-Alves
2012-08-07 20:43 ` Marius Amado-Alves
2012-08-07 21:59 ` Robert A Duff
2012-08-07 22:19 ` Adam Beneschan
2012-08-08 0:37 ` Robert A Duff
2012-08-07 15:26 ` Adam Beneschan
2012-08-07 18:07 ` Marius Amado-Alves
2012-08-07 17:51 ` Simon Wright
2012-08-06 20:00 ` Marius Amado-Alves
2012-08-06 19:49 ` Jacob Sparre Andersen
2012-08-06 20:11 ` Marius Amado-Alves
2012-08-06 17:37 ` Michael Rohan
2012-08-06 18:23 ` Marius Amado-Alves
2012-08-06 19:36 ` Michael Rohan
2012-08-09 21:15 ` Randy Brukardt
2012-08-07 5:57 ` Jeffrey R. Carter
2012-08-07 15:46 ` Adam Beneschan
2012-08-07 17:51 ` Jeffrey R. Carter
2012-08-09 21:17 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox