2 Lexical Elements - Ada 95 Rationale

From OC Systems Wiki!
Jump to: navigation, search

There are only a small number of changes in this part of the language but they are important. The following are worth noting

  • There are six more reserved words.
  • The program text character set is extended.
  • The rules regarding pragmas are improved.

2.1 Reserved Words and Identifiers

Ada 95 has six more reserved words which are abstract, aliased, protected, requeue, tagged, and until. In addition the word "access" is also used as both an attribute and a reserved word.

The introduction of new reserved words poses a potential incompatibility problem. However, the new words are not likely to have been particularly popular as program identifiers and so little problem should arise.

It was suggested by some reviewers that new reserved words should be avoided by the subtle reuse of existing words in various contexts. This might have led to a bizarre and unnatural language for the sake of avoiding very occasional incompatibility. It would certainly have made the language seem strange and unattractive especially to those not familiar with the background to the development. The smooth integration of the new and important features such as type extension and protected types could not have been achieved without the introduction of additional reserved words.

There are some changes to the terminology in order to clarify the exposition. For example, reserved words are no longer formally classed as identifiers; this has some impact on the syntax as mentioned in 1.3. Also the term numeral is introduced in the discussion of literals.

2.2 Program Text

As part of the original agreement between ISO and ANSI to accept ANSI/MIL-STD-1815A as an international standard, ANSI agreed to provide better support for international character sets in the first revision of Ada.

Therefore, Ada 95 uses an 8-bit character set based on ISO-8859, and a 16-bit character set based on ISO-10646. These extended character sets are usable in character and string literals and also in comments.

The text of a program (outside literals) is typically written in the Latin-1 set, ISO-8859-1 and thereby allows accented characters in identifiers.

Moreover, an implementation is allowed to support other character sets provided that it has a mode in which the "standard" sets are supported. This enables national variations to support sets such as those used in Japan. See [RM95 2.1].

In order to promote portability all implementations are required to support a line length of at least 200 characters.

2.3 Pragmas

In order to improve error detection when dealing with implementation defined pragmas, we require that compilers produce a warning when a pragma is unrecognized, and identify as an error a pragma that is misplaced or malformed. In Ada 83, it was permissible for compilers to ignore such pragmas without a warning, which could lead to unexpected behavior.

We have formalized the definition of configuration pragmas to specify options that affect more than a single compilation unit (often an entire program).

There are a number of additional pragmas in Ada 95 which will be mentioned in the course of the discussion.

2.4 Requirements Summary

The requirement and study topic

  • R3.1-A(4) - Extended Comment Syntax
  • S3.1-A(5) - Extended Identifier Syntax

are both addressed and met by the changes mentioned above. Indeed, recently approved Ada Issues permit Ada 83 compilers to meet these requirements on a voluntary (non-binding) basis.

Laurent Guerby Ada 95 Rationale