Rationale for Ada 2005

John Barnes
Contents   Index   References   Search   Previous   Next 

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:
230
Generalized use of anonymous access types
231
Access to constant parameters, null-excluding types
254
Anonymous access to subprogram types
318
Limited and anonymous access return types
363
Eliminating access subtype problems
382
Current instance rule and anonymous access types
384
Discriminated type conversion rules
385
Stand-alone objects of anonymous access types
392
Prohibit unsafe array conversions
402
Access discriminants of nonlimited types
404
Not null and all in access parameters and types
406
Aliased permitted with anonymous access types
409
Conformance with access to subprogram types
416
Access results, accessibility and return statements
420
Resolution of universal operations in Standard
423
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).

Contents   Index   References   Search   Previous   Next 
© 2005, 2006, 2007 John Barnes Informatics.
Sponsored in part by:
The Ada Resource Association and its member companies: ARA Members AdaCore Polyspace Technologies Praxis Critical Systems IBM Rational Sofcheck and   Ada-Europe:
Ada-Europe