Rationale for Ada 2005

John Barnes
Contents   Index   References   Search   Previous   Next 

2.1 Ada Issues: Object-oriented model

The WG9 guidance document [1] identifies very large complex systems as a major application area for Ada. It says
"The main purpose of the Amendment is to address identified problems in Ada that are interfering with Ada's usage or adoption, especially in its major application areas (such as high-reliability, long-lived real-time and/or embedded applications and very large complex systems). The resulting changes may range from relatively minor, to more substantial."
Object oriented techniques are of course important in very large systems in providing flexibility and extensibility. The document later asks the ARG to pay particular attention to
Improvements that will remedy shortcomings in Ada. It cites in particular improvements in OO features, specifically, adding a Java-like interface feature and improved interfacing to other OO languages. 
Ada 2005 does indeed make many improvements in the object oriented area. The following Ada Issues cover the relevant changes and are described in detail in this chapter:
218
Accidental overloading when overriding
251
Abstract interfaces to provide multiple inheritance
252
Object.Operator notation
260
Abstract formal subprograms & dispatching constructors
284
New reserved words
310
Ignore abstract nondispatching ops during overloading
344
Allow nested type extensions
348
Null procedures
391
Functions with controlling results on null extension
396
The "no hidden interfaces" rule (this is discussed in Section 5.3)
401
Terminology for interfaces
405
Progenitors and Ada.Tags
407
Terminology and semantics for prefix names
411
Equality for types derived from interfaces
417
Lower bound of functions in Ada.Tags etc
419
Limitedness of derived types
430
Convention of inherited subprograms
These changes can be grouped as follows.
First we discuss the fact that Ada 2005 has three new reserved words, interface, overriding, and synchronized. It so happens that these are all used in different aspects of the OO model and so we discuss them in this chapter (284).
Then there is the introduction of the Obj.Op or prefixed notation used by many other languages (252, 407). This should make Ada easier to use, improve its image, and improve interfacing to other languages.
A huge improvement is the addition of Java-like interfaces which allow proper multiple inheritance (251, 396, 401, 411, 419, 430). A related change is the introduction of null procedures as a category of operation somewhat like abstract operations (348).
Type extension is now permitted at a more nested level than that of the parent type (344). An important consequence is that controlled types no longer need to be declared at library level.
An interesting development is the introduction of generic functions for the dynamic creation of objects of any type of a class (260, 400, 405, 417). These are sometimes called object factory functions or just object factories.
Additional syntax permits the user to say whether an operation is expected to be overriding or not (218). This detects certain unfortunate errors during compilation which otherwise can be difficult to find at execution time. A small change to the overriding rules is that a function with a controlling result does not "go abstract" if an extension is in fact null (391). Finally, we discuss a minor but useful change to the overloading rules; in a sense this is not about OO at all since it concerns the rules for nondispatching operations but it is convenient to discuss it here (310).
There are many other OO related improvements in Ada 2005 concerning matters such as access types, visibility, and generics. They will be described in Chapters 3 and 6.

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