|
LCS-2016-018a |
|
1 {03-Jan-2017} |
|
03-Jan-2017 |
|
Voting |
|
Patrick Lehmann |
|
Main.PatrickLehmann |
|
Attributes for Enumerated Types |
|
Adds new attributes. |
'ELEMENT
attribute to access the elements 'INDEX
attribute.
This LCS is required by LCS-2016-059a, which was separated due to this missing attribute.
A'INDEX[(N)] | Kind: | Subtype |
Prefix: | Any prefix A that is appropriate for an array object, or an alias thereof, or that denotes an array subtype. |
|
Parameter: | A locally static expression of type universal_integer, the value of which shall not exceed the dimensionality of A. If omitted, it defaults to 1. |
|
Result: | The subtype of the Nth index range of A. (If A is an alias for an array object, then the result is determined by the declaration of A, not that of the object.) |
'left
, 'high
, etc.), very simple language should suffice to describe the result. I have edited the proposal with the language I think is best. I also changed the name of the attribute to be similar to 'element
and 'base
.
-- A(N)'SUBTYPE
returns the subtype of an element, not the subtype of an array index range. type arr is array(natural range 0 to 7, natural range 0 to 3) of bit;
arr'ELEMENT
returns the elements subtype -> bit
arr(N)'SUBTYPE
returns the subtype of the Nth element (same as above)
arr'RANGE
returns the range of =arr='s index, but not it's subtype, thus the range can not be used to get an index type alias or subtype
(sub)type idx is arr'RANGE;
type idx is range arr'LOW to arr'HIGH;
idx
definitions (if working) cannot be used to index an element in an array of type arr
.