comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Self-referential 'Access
Date: 1998/04/20
Date: 1998-04-20T00:00:00+00:00	[thread overview]
Message-ID: <Erq5LL.6Lu.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 353B4DC4.EB3650F4@ghg.net


Stanley Allen (sallen@ghg.net) wrote:

: ...
: The rules for "statically deeper" levels are given
: under RM95:3.10.2(17).  The only rule that seems
: like it might apply here is RM95:3.10.2(21).

: So, I have a few questions.

: 1) Are the compilers in error, or is this code?

The code is in error.

: 2) If this code is in error, is it because of the
:    rule at paragraph (21)?

Yes.

: 3) If so, does this rule really make sense?
:    It does not seem right that these 'Access
:    references should be considered "deeper" than
:    the access type.

The problem is that you are creating a value of a named access type.  
It is true that storing such references inside the object itself will 
not cause trouble.  But because the access type is named, there is nothing
precluding your copying their value into some other object
of the same access type, with no further accessibility check.
It is quite possible that that object might outlive the limited
record object.

: 4) Should the rule disallow only non-limited
:    records?

The rule as written in justifiable, because there are no
further checks when you copy the value from an object having a named 
access type.

As pointed out in another response, you can use 'Unchecked_Access
to bypass the check.  You must still be careful not to copy
the components into global variables that outlive the limited record object.

: Stanley Allen
: mailto:sallen@ghg.net

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




  reply	other threads:[~1998-04-20  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-20  0:00 Self-referential 'Access Stanley Allen
1998-04-20  0:00 ` Tucker Taft [this message]
1998-04-20  0:00 ` Matthew Heaney
1998-04-20  0:00   ` Jerry van Dijk
replies disabled

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