comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How to access an array using two different indexing schemes
Date: Thu, 30 Nov 2017 15:57:10 -0600
Date: 2017-11-30T15:57:10-06:00	[thread overview]
Message-ID: <ovpurm$9ae$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: f8ak08F916jU1@mid.individual.net

"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
news:f8ak08F916jU1@mid.individual.net...
> On 17-11-30 13:40 , AdaMagica wrote:
>> OK, I dived into the RM:
>>
>> 8.5.1(4) The renamed entity shall be an object.
>> 3.3(12) [An object is a] view conversion of another object.
>> 4.6(5/2) A type_conversion whose operand is the name of an
>> object is called a view conversion if both its target type
>> and operand type are tagged, or if it appears in a call as
>> an actual parameter of mode out or in out; other
>> type_conversions are called value conversions.
>>
>> So my conclusion is:
>>
>> The renamings here are illegal (not tagged).
>> The subprogram calls as shown in my previous post are legal.
>>
>> Didn't try however. Good luck for you!
>
> Perhaps the next Ada revision could extend 4.6(5/2) to include a type 
> conversion in a renaming, as a view conversion?

The first part is already proposed: see AI12-0226-1. The second part would 
be problematic (at least in general), because of the rather wacky semantics 
of view conversions for untagged types (where were designed only for 
parameter passing with copy-in/copy-out semantics). For instance, you'd be 
making the following legal:

           Some_Seconds : Duration;

           Flt_Sec : Float renames Float(Some_Seconds);

           Flt_Sec := <Some_Complex_Float_Expression>;

which would most likely hide some interesting rounding issues (including 
precisely when those would happen). Definitely not just a drop in change.

The array case discussed here would work well, though.

                               Randy.


  parent reply	other threads:[~2017-11-30 21:57 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-24 11:42 How to access an array using two different indexing schemes Jerry
2017-11-24 12:33 ` Jeffrey R. Carter
2017-11-24 15:52   ` AdaMagica
2017-11-24 22:25     ` Jerry
2017-11-25 13:57       ` AdaMagica
2017-11-24 22:23   ` Jerry
2017-11-25 15:39   ` Robin
2017-11-25 20:58     ` Jerry
2017-11-26 10:22       ` Robin
2017-11-28 21:57       ` G. B.
2017-11-24 17:37 ` A. Cervetti
2017-11-24 21:48   ` Jerry
2017-11-24 22:15     ` Robert A Duff
2017-11-24 23:38       ` Jerry
2017-11-26  1:07         ` Jerry
2017-11-26  8:58           ` Dmitry A. Kazakov
2017-11-26 10:31             ` Jerry
2017-11-28  1:31             ` Randy Brukardt
2017-11-28  1:25   ` Randy Brukardt
2017-11-29  4:57     ` Jerry
2017-11-29 15:01       ` AdaMagica
2017-11-29 15:21         ` AdaMagica
2017-11-30  5:32           ` Jerry
2017-11-30  5:30         ` Jerry
2017-11-29 15:03       ` AdaMagica
2017-11-29 20:53         ` Randy Brukardt
2017-11-29 16:03       ` Shark8
2017-11-29 17:04         ` AdaMagica
2017-11-29 20:56           ` Randy Brukardt
2017-11-30  5:56             ` Jerry
2017-11-30 11:11               ` AdaMagica
2017-11-30 11:40                 ` AdaMagica
2017-11-30 14:47                   ` Niklas Holsti
2017-11-30 17:30                     ` AdaMagica
2017-11-30 19:31                       ` G. B.
2017-11-30 19:43                         ` Shark8
2017-11-30 22:10                           ` Randy Brukardt
2017-11-30 21:57                     ` Randy Brukardt [this message]
2017-11-30 22:49                 ` Jerry
2017-11-30 23:00                   ` Jerry
2017-11-30 21:50               ` Randy Brukardt
2017-11-30 23:13                 ` Jerry
2017-11-24 18:37 ` Per Sandberg
2017-11-24 21:28   ` Jerry
2017-11-24 21:40     ` Dmitry A. Kazakov
2017-11-28  1:33     ` Randy Brukardt
2017-11-24 22:12 ` Robert A Duff
2017-11-28  1:39   ` 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