From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How to access an array using two different indexing schemes Date: Thu, 30 Nov 2017 15:57:10 -0600 Organization: JSA Research & Innovation Message-ID: References: <0b6bd27e-e9ec-4854-bbb1-85e1d9ac92e1@googlegroups.com> <227d5a7f-6d5b-4b76-ac31-7d15bb6dc284@googlegroups.com> <16c980c2-1fa6-4084-97ea-b576c75b99c3@googlegroups.com> <3ca6a682-9af1-40e3-a4ac-db739b38e4d7@googlegroups.com> <8a31c728-0261-4f41-b82e-e7128369ebc1@googlegroups.com> Injection-Date: Thu, 30 Nov 2017 21:57:10 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="9550"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:49282 Date: 2017-11-30T15:57:10-06:00 List-Id: "Niklas Holsti" 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 := ; 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.