Version 1.2 of ais/ai-00284.txt

Unformatted version of ais/ai-00284.txt version 1.2
Other versions for file ais/ai-00284.txt

!standard 2.09 (02)          02-01-23 AI95-00284/01
!class amendment 02-01-23
!status work item 02-01-23
!status received 02-01-23
!priority Medium
!difficulty Medium
!subject Nonreserved words
New lexical constructs, named "nonreserved words" are introduced. They make it possible to add new syntax without compromising the readability of the language, and without introducing incompatibilities.
The addition of new language features for the next revision of Ada appears difficult to do without the addition of new syntax. However, in some cases the addition of new syntax is problematic without new reserved words. Adding new reserved words is probably not an option at this late stage for compatibility reasons, but on the other hand using only existing reserved words can lead to constructs that are hard to understand.
Here are two examples from some of the amendments that have recently been discussed by the ARG:
type T is abstract; -- This is really an interface a la Java.
procedure Finalise (Object : in out Root_Type); pragma overriding;
It both cases, it could be argued that the introduction of new reserved words would make the purpose of the construct more explicit, and would therefore improve the readability of the language:
type T is abstract interface;
procedure Finalise (Object : in out Root_Type) is overriding;
(In the second case a solution based on a pragma has the advantage of being usable in Ada 95, without waiting for the next revision of the language; still, it looks like a wart.)
This amendment introduces a new category of lexical elements, _nonreserved_words_. Examples of nonreserved words could be (ignoring upper/lower case distinctions):
interface overriding
Nonreserved words have special meaning in the syntax (where they appear as terminals). They appear in lower case boldface in the RM, just like reserved words. Here are two examples of possible BNF productions including nonreserved words:
type_definition ::= ... | abstract_interface_definition abstract_interface_definition ::= abstract [limited] interface
subprogram_specification ::= procedure defining_program_unit_name parameter_profile overriding_indication | function defining_designator parameter_and_result_profile overriding_indication overriding_indication ::= is overriding
Evidently, the productions which involve nonreserved words must be such that they do not make the grammar ambiguous, or do not require unreasonable lookahead. This will have to be checked on a case-by-case basis.
An identifier (2.3) may be a nonreserved word. This is the rule that ensures that the introduction of new syntax using nonreserved words is a compatible process.
!ACATS test


Questions? Ask the ACAA Technical Agent