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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a41c4a2c795dbe34 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder.erje.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Will "renames" increase program size? Date: Thu, 16 Jun 2011 18:22:08 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <46294109-f07d-49c0-8e81-65a369a05ced@z15g2000prn.googlegroups.com> <1ayjsy885qg2b$.13bmeo97hbau1$.dlg@40tude.net> <316ac8ed-1ded-43d0-98d1-36bb2c0221ad@f2g2000yqh.googlegroups.com> <4bdd2495-fb00-4aa7-89bd-910dfefa3704@i4g2000yqg.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1308266531 12359 69.95.181.76 (16 Jun 2011 23:22:11 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 16 Jun 2011 23:22:11 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 Xref: g2news2.google.com comp.lang.ada:20866 Date: 2011-06-16T18:22:08-05:00 List-Id: "AdaMagica" wrote in message news:4bdd2495-fb00-4aa7-89bd-910dfefa3704@i4g2000yqg.googlegroups.com... >> procedure Shame is >> type T is array (Integer range <>) of Integer; >> A : T := (0 => 0, 1 => 1); >> subtype S is T (1..2); >> B : S renames A; >> begin >> Put_Line (Integer'Image (B (0))); -- Surprise, 0 is a legal index of S! >> end Shame; > >Yes, agreed, that's annoying and confusing. Perhaps such a renaming >should be forbidden. Don't know what other consequences such a rule >would have, which other rules would have to be adapted. Think of >generics... (I know you dislike generics.) Everyone agrees that this was a mistake of Ada 83, mainly because it didn't have the concept of static matching. (Someone dug up the 1983 e-mail thread that led to this mistaken rule.) However, fixing it would be widely incompatible -- for instance, virtually all renames of operators would be illegal under a matching rule (their parameters would need to be T'Base, but hardly anyone actually writes that). We've looked at rules that would be less incompatible, but they get very complex and it just didn't seem worth the headaches. We've discussed this before on comp.lang.ada (I don't recall exactly when). Randy.