Use of & and 'IMAGE in static expressions 86-07-23 AI-00219/06 1
| !standard 04.09 (02) 86-07-23 AI-00219/06
| !class binding interpretation 84-03-13
| !status approved by WG9/AJPO 86-07-22
| !status approved by Director, AJPO 86-07-22
| !status approved by WG9/Ada Board 86-07-22
| !status approved by Ada Board 86-07-22
!status approved by WG9/ADA Board 85-02-26
!status committee-approved 84-11-26
!status work-item 84-06-11
!status received 84-03-13
!references 83-00323
!topic Use of & and 'IMAGE in static expressions
!summary 84-12-10
In a static expression, every factor, term, simple expression, and relation
must have a scalar type.
!question 84-12-10
According to 4.9(2), the following expressions are static:
'a' & 'b' = 'c' & 'd'
INTEGER'IMAGE(555) = INTEGER'IMAGE(666)
In the first expression, each primary is an enumeration literal, the
expression delivers a scalar type (BOOLEAN), and "&" and "=" are predefined
operators. In the second expression, IMAGE is a language defined attribute
of a static subtype (INTEGER) and its actual parameter is a static
expression, so both primaries satisfy the requirements of 4.9(f). The fact
that 'a' & 'b' and INTEGER'IMAGE(555) are not themselves static expressions
(because they are not of a scalar type) doesn't seem to matter. The complete
expressions given above satisfy the definition of a static expression, even
though this is probably not what was intended. Are the above expressions
intended to be considered static expressions?
!recommendation 84-12-10
In a static expression, every factor, term, simple expression, and relation
must have a scalar type. (This implies that neither the catenation operator
nor the predefined attribute IMAGE can be used in static expressions.)
!discussion 84-12-10
The intent of the RM was to require only the compile time evaluation of
scalar expressions. The examples show that this intent is not realized if
"&" and 'IMAGE are allowed in such expressions.