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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,4215feeab2a8154a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Language checks (Was: C++0x and Threads - a poor relation to Ada's tasking model?) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <7q2385104kihs87d79p8kfphuoki6r01vq@4ax.com> <7961a91c-a5af-40e2-bbc0-6bf69a98176d@z31g2000yqd.googlegroups.com> <362f621e-a01c-4772-ba02-4e18e9962188@j19g2000vbp.googlegroups.com> <128d63da-361f-4e33-be5e-e06bdc71e39f@r34g2000vba.googlegroups.com> <6d23274b-d649-4a83-a6f1-6d1e9c4c3998@d34g2000vbm.googlegroups.com> <4A83D107.2020407@obry.net> <196q25f7ntf6a$.tj10ulon3mmt.dlg@40tude.net> <4A83F9C2.3000700@obry.net> <1376nmezwawim.1mqgiaglsrvwe.dlg@40tude.net> <874osar63q.fsf_-_@jspa-nykredit.sparre-andersen.dk> <5teik046uoaz.dust9cbmbaxl.dlg@40tude.net> <09abf252-0517-4320-975c-63e834cc54ae@w41g2000yqb.googlegroups.com> Date: Fri, 14 Aug 2009 16:13:49 +0200 Message-ID: <669hmy6yhk8d$.xtpisczyxd6l$.dlg@40tude.net> NNTP-Posting-Date: 14 Aug 2009 16:13:15 CEST NNTP-Posting-Host: 65bfd480.newsspool2.arcor-online.net X-Trace: DXC=nbVD1JfRTUnm7>ihJR;B_cA9EHlD;3Ycb4Fo<]lROoRa^YC2XCjHcbid8LUkWUHgabDNcfSJ;bb[eFCTGGVUmh?dLK[5LiR>kgbPa2Vd56;KCm X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7785 Date: 2009-08-14T16:13:15+02:00 List-Id: On Fri, 14 Aug 2009 06:33:21 -0700 (PDT), REH wrote: > On Aug 14, 8:01�am, "Dmitry A. Kazakov" > wrote: >> declare >> � �B_View : array (Index range A'Range) of Element renames B; >> begin > > I didn't know you could do that! That's very cool. No, unfortunately it is illegal, and for all, renaming of arrays is broken in Ada. It does not slide indices. Consider this: with Ada.Text_IO; use Ada.Text_IO; procedure Test_Arrays is type T is array (Positive range <>) of Integer; subtype S is T (10..20); X : T (1..10) := (others => 0); Y : S renames X; begin Ada.Text_IO.Put_Line (Integer'Image (Y'First)); end Test_Arrays; It prints 1, instead of expected 10. > So, as long as the > element type and length are the same, Ada will let you change the > index type in a rename? Not in renaming, but in type conversion it is OK. Unfortunately type conversions are not allowed in renaming. (But function calls are) I think the whole issue should be revised some day... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de