- Decimal arithmetic
- User defined assignment/controlled types
- Run-time type information
- “Use type”
- Enhanced generics
- Mixing of declarations and bodies
- Asynchronous transfer of control
- New standard packages:
- - Fixed length strings
- -Bounded-length strings
- -Unbounded-length strings
- -Wide strings
- -Elementary functions
- -Random numbers
- -Stream_IO
- -Exception information
Previous slide | Contents | Next slide |
From the Script: Slide 24 - Other, Miscellaneous Changes
Decimal Arithmetic - Decimal arithmetic is supported by the Information Systems Annex and is an enhancement to Ada associated with support for COBOL type programs [Barnes]. This annex provides the rules for performing division, and for formatting I/O into human readable form. Support is also included for a type Picture similar to the COBOL equivalent and allows a means for localizing the currency symbol, filler characters, digit separators, and the radix mark.
User defined assignment/controlled types - Initialization, finalization and assignment are fundamental actions for manipulation of objects. A controlled type gives the user additional control over parts of these operations. The user can define: 1) an Initialize procedure which is invoked immediately after the normal default initialization of a controlled object; 2) a Finalize procedure which is invoked immediately before finalization of any of the components of a controlled object; and 3) an Adjust procedure which is invoked as the last step of an assignment to a (nonlimited) controlled object.
"Use type" clause - There is a popular school of thought that believes the 'use' clause is bad because it obscures the origin of entities. The "use type" clause provides visibility to a single entity from within a package, but forces the use of full dot notation for any other entity from the package.
Enhanced Generics - The generic facility in Ada 83 proved very useful in developing reusable software particularly with regard to its type parameterization capability. Ada 95 corrects a few anomalies in the Ada 83 generic and adds a number of additional parameter models to match the new object-oriented facilities. Several enhancements to the generic model include: introduction of a distinct formal notation which enables definite and indefinite subtypes to be treated separately; new formal notations for modular and decimal types; extention of access type matching rules to accommodate the additional forms of access types; a new formal notation for package parameters; and others. [Ada 95 Rationale 12]
Mixing of declarations and bodies - The Ada 83 restriction against types subtypes, and objects being declared after bodies (including body stubs) within a declarative part has been removed in Ada 95. This permits moving local variable declarations of a subprogram body to the end of its declarative part. [Ada 95 Rationale 3]
Asynchronous transfer of control - This enables an activity to be abandoned if some condition arises (such as running out of time) and an alternative sequence of statements to be executed instead. This provides the capability to perform mode changes. Asynchronous transfer of control is achieved by a new form of select statement which comprises two parts: an abortable part and a triggering alternative. [Ada 95 LRM II.10]
New Standard Packages - Ada 95 added multiple string manipulation packages to the standard library to support fixed, bounded, unbounded, and wide strings.
· The Elementary_Functions package is added to provide basic floating point numerical calculations for use with the predefined type Float.· Facilities for generation of pseudo-random floating point numbers are added by package Numerics.Float_Random.
· Package Stream_IO provides support for manipulation of totally heterogeneous files.
· Exception information returns implementation-defined information about the occurrence of an exception.