comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Subverting 'Access for Sub-programs
Date: 1999/08/06
Date: 1999-08-06T00:00:00+00:00	[thread overview]
Message-ID: <7oejga$28i$1@nnrp1.deja.com> (raw)
In-Reply-To: Pine.BSF.4.10.9908052144260.14625-100000@shell5.ba.best.com

In article
<Pine.BSF.4.10.9908052144260.14625-100000@shell5.ba.best.com>,
> It was probably the right choice at the time (1990-1995) to
> exclude downward funargs, and Robert Dewar's statement about
> the pain some implementor's would have suffered seems
> reasonable enough. It won't seem reasonable much longer
> though.

Indeed! And probably it is time for the ARG to address this
issue, and decide on an accepted language extension in this
area.

I am not sure that Unrestricted_Access (as defined by GNAT
for procedures) should be part of that proposal. Most certainly
you also want a "safe" version similar to what was proposed in
earlier mapping documents (the limited access to subprogram
feature).

Note that Unrestricted_Access in GNAT has three quite different
meanings:

1. For objects other than slices and unconstrained array types,
it provides a considerably nicer diction than taking the
'Address and converting the address to the required
access type by using unchecked conversion (a common Ada 83
diction). Since it adds no expressive capability, and is
obviously no implementation burden, this usage seems one that
would usefully be included in all Ada compilers.

2. For slice objects and unconstrained array type pointers, GNAT
permits capturing pointers to slices that "work", although there
are fairly subtle scoping restrictions. This very much depends
on the internal approach that GNAT uses for such pointers (the
so called "fat" pointers). It is not a usage that should be
encouraged, and certainly not one that should be standardized
at this time, since it would have far reaching implementation
impact in compilers other than GNAT. So this use of
Unrestricted_Access should definitely be considered to be
GNAT dependent (it can of course be VERY useful in some
situations, e.g. we have found it very useful for some work in
automatic translation of COBOL code).

3. For subprograms, Unrestricted_Access provides a general
mechanism corresponding really to what would more naturally
be called Unchecked_Access, and to me the natural extension
in the language would be to use Unchecked_Access for the
purpose. I don't see any big semantic problem here. Pointers
generated by the use of UA are the same as any other pointers
generated by use of UA, namely you had better not use them
when the corresponding referenced gizmo (be it an object as
now allowed in the language, or a subprogram, as now forbidden)
goes out of scope. The implementation impact is no worse than
will be required for general downward funargs, so if you buy
the latter, why not allow Unchecked_Access on subprograms as
the natural extension.

I think that even if you implement the "safe" downward funargs
features, you will still feel a need for UA on subprograms. The
situations in which you need this are exactly similar to those
which cause you to use UA for objects, e.g. you want to park
pointers in some global structures, for later use, and you
happen to know that your logic is such that they will not be
used after the referenced gizmo has gone out of scope.

For example, I have a general library level procedure that does
callbacks, and expects to be passed a record containing the
stuff necessary for the callback processing, including an
access-to-subprogram value. Currently I can't use a nested
subprogram for that purpose which is annoying, and the "safe"
proposal still won't allow it.

Robert Dewar


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




  reply	other threads:[~1999-08-06  0:00 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-03  0:00 Subverting 'Access for Sub-programs Anton Gibbs
1999-08-03  0:00 ` Ted Dennison
1999-08-03  0:00 ` Steve Doiel
1999-08-03  0:00 ` tmoran
1999-08-03  0:00 ` Michael F. Yoder
1999-08-03  0:00 ` Brian Rogoff
1999-08-03  0:00 ` David C. Hoos, Sr.
1999-08-05  0:00   ` Robert A Duff
1999-08-04  0:00 ` Robert Dewar
1999-08-04  0:00   ` Robert A Duff
1999-08-04  0:00     ` Robert Dewar
1999-08-04  0:00 ` Anton Gibbs
1999-08-04  0:00   ` Jean-Pierre Rosen
1999-08-04  0:00     ` Brian Rogoff
1999-08-05  0:00       ` Jean-Pierre Rosen
1999-08-05  0:00         ` Robert A Duff
1999-08-05  0:00           ` Brian Rogoff
1999-08-06  0:00             ` Robert Dewar [this message]
1999-08-09  0:00               ` Tucker Taft
1999-08-10  0:00                 ` Robert Dewar
1999-08-11  0:00                   ` Dmitry A. Kazakov
1999-08-11  0:00                     ` Robert Dewar
1999-08-12  0:00                       ` Dmitry A. Kazakov
1999-08-14  0:00                         ` Robert Dewar
1999-08-16  0:00                           ` Dmitry A. Kazakov
1999-08-11  0:00                     ` Richard D Riehle
1999-08-11  0:00                   ` Robert A Duff
1999-08-11  0:00                     ` Robert Dewar
1999-08-11  0:00                   ` Tucker Taft
1999-08-13  0:00                     ` Robert Dewar
1999-08-13  0:00                       ` Brian Rogoff
1999-08-13  0:00                     ` Robert Dewar
1999-08-05  0:00           ` tmoran
1999-08-06  0:00             ` Robert A Duff
1999-08-05  0:00           ` Robert Dewar
1999-08-05  0:00         ` adam
1999-08-05  0:00           ` adam
1999-08-06  0:00             ` Robert A Duff
1999-08-06  0:00               ` adam
1999-08-09  0:00                 ` Robert A Duff
1999-08-09  0:00                 ` Mark Biggar
1999-08-05  0:00           ` Robert Dewar
1999-08-05  0:00             ` What is a Display ? (was: Subverting 'Access for Sub-programs) Larry Kilgallen
1999-08-05  0:00               ` Hyman Rosen
1999-08-06  0:00                 ` Robert Dewar
1999-08-06  0:00               ` Robert Dewar
1999-08-06  0:00         ` Subverting 'Access for Sub-programs Brian Rogoff
1999-08-07  0:00           ` Gautier
1999-08-05  0:00     ` Robert A Duff
1999-08-05  0:00       ` Robert Dewar
1999-08-05  0:00         ` Brian Rogoff
1999-08-04  0:00   ` Robert A Duff
1999-08-04  0:00     ` Brian Rogoff
1999-08-05  0:00       ` tmoran
1999-08-05  0:00         ` Aidan Skinner
1999-08-05  0:00         ` Robert Dewar
1999-08-05  0:00           ` Ray Blaak
1999-08-06  0:00             ` Robert Dewar
1999-08-06  0:00               ` Robert A Duff
1999-08-08  0:00                 ` Brian Rogoff
1999-08-09  0:00                   ` Robert A Duff
1999-08-10  0:00                     ` Brian Rogoff
1999-08-09  0:00                 ` Tucker Taft
1999-08-06  0:00             ` Jean-Pierre Rosen
1999-08-06  0:00               ` Hyman Rosen
1999-08-07  0:00                 ` Florian Weimer
1999-08-05  0:00     ` Anton Gibbs
1999-08-05  0:00   ` Steve Quinlan
replies disabled

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