Rationale for Ada 2005
3.1 Ada Issues: Access types
The WG9 guidance document
[1]
does not specifically mention access types as an area needing attention.
Access types are, of course, more of a tactical detail than a strategic
issue and so this is not surprising.
However, the guidance document strongly emphasizes
improvements to object oriented programming and the use of access types
figures highly in that area. Indeed one of the motivations for changes
was to reduce the number of explicit access type conversions required
for OOP.
The guidance document also asks for "improvements
that will remedy shortcomings in Ada". The introduction of anonymous
access-to-subprogram types comes into that category in the minds of many
users.
The following Ada Issues
cover the relevant changes and are described in detail in this chapter:
Generalized use of anonymous access types
Access to constant parameters, null-excluding types
Anonymous access to subprogram types
Limited and anonymous access return types
Eliminating access subtype problems
Current instance rule and anonymous access types
Discriminated type conversion rules
Stand-alone objects of anonymous access types
Prohibit unsafe array conversions
Access discriminants of nonlimited types
Not null and all in access parameters and types
Aliased permitted with anonymous access types
Conformance with access to subprogram types
Access results, accessibility and return statements
Resolution of universal operations in Standard
Renaming, null exclusion and formal objects
These changes can be grouped as follows.
First, there is a general orthogonalization of the
rules regarding whether the designated type is constant and whether the
access subtype includes null (
231,
part of
404,
part of
423).
A major change is the ability to use anonymous access
types more widely (
230,
part of
318,
385,
392,
part of
404,
406,
part of
416,
part of
420).
This was found to require some redefinition of the rules regarding the
use of a type name within its own definition (
382).
Access discriminants are now also permitted with nonlimited types (
402).
The introduction of anonymous access-to-subprogram
types enables local subprograms to be passed as parameters to other subprograms
(
254,
409).
This has been a feature of many other programming languages for over
40 years and its omission from Ada has always been both surprising and
irritating and forced the excessive use of generics.
Finally there are some corrections to the rules regarding
changing discriminants which prevent attempting to access components
of variants that do not exist (
363).
There is also a change to the rules concerning type conversions and discriminants
to make them symmetric (
384).
© 2005, 2006 John Barnes Informatics.
Sponsored in part by: