TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Robert I. Eachus" <[log in to unmask]>
Reply To:
Robert I. Eachus
Mon, 7 Jul 1997 17:51:20 -0400
text/plain (44 lines)
At 05:58 PM 7/4/97 +0100, Christoph & Ursula Grein wrote:

>  Now I've really tried hard to find a solution for the unlimited type, but
> the only one I found is an ugly solution to the problem.
> Using a global pointer to intermediately store the access value defeats the
> idea to keep everything hidden inside the object.
> What is more: In a multi-tasking environment, this cannot safely work!

> But the big problem is: How to get the access value of the object just
> finalized before into Adjust?

  You have to have a protected object push it on a stack along with the
location so that tasking won't cause a problem.

> See the remarks in the AARM 7.6 (17a..e). Adjust just knows NOTHING about
> the target.

   Now you see why it gets messy.  My thinking when Ada 9X was being
developed was that if, in the final version, this operation got too
painful, compiler vendors might be forced to provide additional operations
for Controlled, or for a type like it.  Access discriminants seem at first
to be a clean solution, and they are in the limited case.  But in the
non-limited case it is not clean at all--just possible.  (You have to have
a field of the parent record that points to the record itself. After the
copy part of the assignment it points back to the original object--but
beware.)  Due to the implementation permissions that were added for
efficiency in Adjust and Finalize, I think I am going to conclude that we
may need to ask compiler vendors for this support--if it is needed.  I have
gotten this to work in the unlimited case as a kludge.  But since the
limited case was so clean, I decided I would be happier in the long run
with a limited type and an Assign procedure.  (And yes, every subsequent
extension that adds state has to override Assign.)

    If someone can figure out a simple extension to Controlled that will do
this and other jobs right, we can pressure compiler vendors to support it.
If there is no clean easy solution, I can survive quite nicely with limited

                                        Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...