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:39:35 -0500
Date: 2011-06-16T18:39:35-05:00	[thread overview]
Message-ID: <ite47q$cik$1@munin.nbi.dk> (raw)
In-Reply-To: welpqz29i316$.10qazzjvlklcp$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:welpqz29i316$.10qazzjvlklcp$.dlg@40tude.net...
...
> It would be useless to discuss Ada's concept of renaming (or function
> result, or anything else) in the terms of the RM, because in this context
> it neither right or wrong, it just is as it is.

Not at all. We spend hundreds of hours a year talking about things like 
renames in terms of the RM. Moreover, when you are using terminology defined 
by the RM (like "copy", "renames", "return object", "temporary object"), 
it's likely that people (especially Adam and I) will think you are talking 
in those terms. And a renaming (in RM terms) is never a copy.

If you're going to use RM-defined concepts and ignore the RM definition, 
then you ought to clearly say so so that there is less confusion. And you're 
seriously confused on how these things work.

>Semantically returning result of a function is always copying because the
>object being returned changes the scope.

"Changing scope" doesn't require a copy in either RM or some sort of outside 
logical universe. The only thing that the "scope" of an object controls is 
when it is finalized, and that has nothing to do with the contents (from a 
logical perspective) of the object. (If the implementation uses some 
pointers or something for this purpose, that is merely an implementation 
detail and has no effect on the logical properties.) Ada indeed requires 
that this be a single object (so that 'Access works). In further cases, Ada 
requires that the anonymous object "mutate" into the target object with no 
copying ("built-in-place"); this too changes scope.

The point is that copying has a visible semantic effect, and implementations 
cannot just copy things whenever they feel like it -- its only allowed in 
certain cases.

In Ada 95 and 2005, this was supposedly an optimization, but that model 
simply does not work and has been abandoned in favor of requirements to not 
copy. (That was years ago, with a binding interpretation AI05-0067-1.) There 
is still a permission to not copy in some other cases.

                                                Randy.





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