comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Will "renames" increase program size?
Date: Wed, 15 Jun 2011 23:59:35 -0700 (PDT)
Date: 2011-06-15T23:59:35-07:00	[thread overview]
Message-ID: <316ac8ed-1ded-43d0-98d1-36bb2c0221ad@f2g2000yqh.googlegroups.com> (raw)
In-Reply-To: 1ayjsy885qg2b$.13bmeo97hbau1$.dlg@40tude.net

On 15 Jun., 15:15, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Wed, 15 Jun 2011 13:24:52 +0200, Yannick Duchêne (Hibou57) wrote:
> > Le Wed, 15 Jun 2011 07:37:22 +0200, Randy Brukardt <ra...@rrsoftware.com>  
> > a écrit:
> >> Some examples where there probably would be some overhead:
>
> >>              Obj : Natural renames My_Array (Some_Variable).all;
> >>              Obj2 : Float renames Some_Function (A, B);
>
> > Yes, because this is more an aliasing (in the symbolic sense) than a  
> > proper renaming.
>
> Yes, Ada's renaming is not renaming. Consider this:
>
>    Line : String renames Get_Line;
>
> It calls Get_Line once and keeps the result object. In fact it is an
> equivalent to:
>
>    <anonymous> : constant String := Get_Line;
>    Line : properly renames <anonymous>;
>
> Consider also the effect of renaming on the visibility rules:
>
>    package P1 is
>       End_Error : exception renames Ada.Text_IO.End_Error;
>    end P1;
>    package P2 is
>       End_Error : exception renames Ada.Text_IO.End_Error;
>    end P2;
>    use P1, P2;
>
>    exception
>       when End_Error => -- End_Error is hidden!
>
> Ada's "renames" does not rename here, it copies, creates objects. There are
> three End_Error here, all of them are equal, but not same:
>
> exception
>    when Ada.Text_IO.End_Error =>
>       ...
>    when P1.End_Error => -- Error! P1.End_Error has the same value
>       ...
>    when P2.End_Error =>
>       ...
>
> A proper renaming would create identical (x≡y) entities, Ada's renaming
> sometimes creates only equal ones (x=y).
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

That's not correct. A renaming does not copy nor somehow create new
entities, it only creates new names for the same thing. Since
visibility is via names, you arrive at unresolvability issues.



  reply	other threads:[~2011-06-16  6:59 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 [this message]
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
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