[Ada Information Clearinghouse]
Ada '83 Rationale, Ch 15: Representation Clauses and Machine Dependences

"Rationale for the Design of the
Ada® Programming Language"

[Ada '83 Rationale, HTML Version]

Copyright ©1986 owned by the United States Government. All rights reserved.
Direct inquiries to the Ada Information Clearinghouse at adainfo@sw-eng.falls-church.va.us.

CHAPTER 15: Representation Clauses and Machine Dependences

There is an inherent dilemma in the design of a high-order language with a systems programming capability. On the one hand we are trying to achieve reliability by raising the level of the language. For example, we provide data types and encourage the taking of an abstract view of objects, in which they are known only by the set of operations applicable to them: controlling the applicable operations enables incorrect use to be detected.

On the other hand, systems applications require the ability to stay rather close to the machine, and not only for reasons of efficiency. For example, defining a hardware descriptor must be done in terms of the physical properties, the bit positions, and so on. A mapping different from that prescribed by the hardware would not merely be inefficient - it would be incorrect and would not work at all. To produce a correct program in such cases we are forced to abandon the abstract view and to work in terms of the physical representation. This contradiction cannot be avoided. The language must deal with objects at two different levels, the logical and the representation level [Wo 72].

Clearly, dealing with physical representation is inherently dangerous. However, some control can still be achieved if the language enforces a clear separation of the logical properties from their physical representation.

This separation principle is discussed below, along with the problem of changing representation and an analysis of the issues raised by the different forms of representation clause available in the language. This chapter also covers the ways to specify the parameters of a given configuration, and conversely how to ascertain them by environment enquiries. Finally we present the means available for interfacing with other languages.

In this chapter...

15.1 The Separation Principle
15.2 Types and Data Representation
15.3 Multiple Representations and Change of Representation
15.3.1 A Canonical Example of Changes of Representation
15.3.2 One Type - One Representation Principle
15.3.3 Explicit Type Conversion and Change of Representation
15.3.4 Implementation of Representation Changes
15.4 Presentation of the Data Representation Facility
15.4.1 Representation Pragmas
15.4.2 Length Clauses
15.4.3 Record Representation Clauses
15.4.4 Address Clauses
15.4.5 Enumeration Representation Clauses
15.5 Enumeration Types with Noncontiguous Representations
15.5.1 Assignment and Comparison with Noncontiguous Enumeration Types
15.5.2 Indexing and Case Statements with Noncontiguous Enumeration Types
15.5.3 Iteration Over Noncontiguous Enumeration Types
15.5.4 Character Types
15.6 Configuration Specification and Environment Enquiries
15.6.1 The Package SYSTEM
15.6.2 Pragmas for Configuration Specification
15.6.3 Representation Attributes
15.6.4 Configuration Specification and Conditional Compilation
15.7 Interface with Other Languages
15.8 Unchecked Conversions

Address any questions or comments to adainfo@sw-eng.falls-church.va.us.