Version 1.3 of ais/ai-00284.txt

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

!standard 2.09 (02)          02-05-24 AI95-00284/02
!standard 2.09 (03)
!class amendment 02-01-23
!status work item 02-01-23
!status received 02-01-23
!priority Medium
!difficulty Medium
!subject Nonreserved keywords
!summary
A new lexical construct, named "nonreserved keywords" is introduced. It makes it possible to add new syntax without compromising the readability of the language, and without introducing incompatibilities.
!problem
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.)
!proposal
This amendment introduces a new category of lexical elements, _nonreserved_keywords_. We use the term "keyword" because "nonreserved word" would sound strange. For consistency, the term "reserved word" is changed into "reserved keyword".
Examples of nonreserved keywords could be (ignoring upper/lower case distinctions):
interface overriding
Nonreserved keywords have special meaning in the syntax (where they appear as terminals). They appear in lower case boldface in the RM, just like reserved keywords. Here are two examples of possible BNF productions including nonreserved keywords:
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 keywords 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 keyword. This is the rule that ensures that the introduction of new syntax using nonreserved keywords is a compatible process.
!discussion
(See proposal.)
!example
(See proposal.)
!corrigendum 02.09(2)
Replace the paragraph:
The following are the reserved words (ignoring upper/lower case distinctions):
by:
The following are the reserved keywords (ignoring upper/lower case distinctions):
!corrigendum 02.09(3)
Replace the paragraph:
NOTES
The reserved words appear in @key<lower case boldface> in this International Standard, except when used in the @nt<designator> of an attribute (see @RefSecNum(Attributes)). Lower case boldface is also used for a reserved word in a @nt<string_literal> used as an @nt<operator_symbol>. This is merely a convention @em programs may be written in whatever typeface is desired and available.
by:
The following are the nonreserved keywords (ignoring upper/lower case distinctions):
(This list intentionally left blank.)
Reserved keywords are also referred to as reserved words in other parts of this International Standard.
NOTES
The reserved and nonreserved keywords appear in @key<lower case boldface> in this International Standard, except when used in the @nt<designator> of an attribute (see @RefSecNum(Attributes)). Lower case boldface is also used for a reserved keyword in a @nt<string_literal> used as an @nt<operator_symbol>. This is merely a convention @em programs may be written in whatever typeface is desired and available.
!ACATS test
!appendix

*************************************************************

Questions? Ask the ACAA Technical Agent