comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Will "renames" increase program size?
Date: Thu, 16 Jun 2011 18:22:08 -0500
Date: 2011-06-16T18:22:08-05:00	[thread overview]
Message-ID: <ite372$c27$1@munin.nbi.dk> (raw)
In-Reply-To: 4bdd2495-fb00-4aa7-89bd-910dfefa3704@i4g2000yqg.googlegroups.com

"AdaMagica" <christ-usch.grein@t-online.de> 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.





  parent reply	other threads:[~2011-06-16 23:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15  2:10 Will "renames" increase program size? Adrian Hoe
2011-06-15  5:37 ` Randy Brukardt
2011-06-15  9:11   ` AdaMagica
2011-06-15 11:26     ` Yannick Duchêne (Hibou57)
2011-06-15 11:24   ` Yannick Duchêne (Hibou57)
2011-06-15 13:15     ` Dmitry A. Kazakov
2011-06-16  6:59       ` AdaMagica
2011-06-16  8:59         ` Dmitry A. Kazakov
2011-06-16 10:18           ` AdaMagica
2011-06-16 12:15             ` Dmitry A. Kazakov
2011-06-16 23:22             ` Randy Brukardt [this message]
2011-06-16 15:40           ` Adam Beneschan
2011-06-16 16:33             ` Dmitry A. Kazakov
2011-06-16 17:42               ` Adam Beneschan
2011-06-16 18:53                 ` Dmitry A. Kazakov
2011-06-16 23:39                   ` Randy Brukardt
2011-06-17  6:53                     ` Dmitry A. Kazakov
2011-06-18  0:02                       ` Randy Brukardt
2011-06-18  7:54                         ` Dmitry A. Kazakov
2011-06-18  8:58                           ` Yannick Duchêne (Hibou57)
2011-06-18 10:05                             ` Dmitry A. Kazakov
2011-06-18 12:49                               ` Yannick Duchêne (Hibou57)
2011-06-18 22:44                           ` Randy Brukardt
2011-06-22  0:56                             ` Shark8
2011-06-15 22:21 ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox