Go to the first, previous, next, last section, table of contents.


4.1.4 Attributes

  1. An attribute is a characteristic of an entity that can be queried via an attribute_reference or a range_attribute_reference.

    Syntax

  2. attribute_reference ::= prefix'attribute_designator
    
  3. attribute_designator ::=
         identifier[(static_expression)]
       | Access | Delta | Digits
    
  4. range_attribute_reference ::= prefix'range_attribute_designator
    
  5. range_attribute_designator ::= Range[(static_expression)]
    

    Name Resolution Rules

  6. In an attribute_reference, if the attribute_designator is for an attribute defined for (at least some) objects of an access type, then the prefix is never interpreted as an implicit_dereference; otherwise (and for all range_attribute_references), if the type of the name within the prefix is of an access type, the prefix is interpreted as an implicit_dereference. Similarly, if the attribute_designator is for an attribute defined for (at least some) functions, then the prefix is never interpreted as a parameterless function_call; otherwise (and for all range_attribute_references), if the prefix consists of a name that denotes a function, it is interpreted as a parameterless function_call.
  7. The expression, if any, in an attribute_designator or range_attribute_designator is expected to be of any integer type.

    Legality Rules

  8. The expression, if any, in an attribute_designator or range_attribute_designator shall be static.

    Static Semantics

  9. An attribute_reference denotes a value, an object, a subprogram, or some other kind of program entity.
  10. A range_attribute_reference X'Range(N) is equivalent to the range X'First(N) .. X'Last(N), except that the prefix is only evaluated once. Similarly, X'Range is equivalent to X'First .. X'Last, except that the prefix is only evaluated once.

    Dynamic Semantics

  11. The evaluation of an attribute_reference (or range_attribute_reference) consists of the evaluation of the prefix.

    Implementation Permissions

  12. An implementation may provide implementation-defined attributes; the identifier for an implementation-defined attribute shall differ from those of the language-defined attributes.

    NOTES

  13. (4) Attributes are defined throughout this International Standard, and are summarized in See section K Language-Defined Attributes (informative).
  14. (5) In general, the name in a prefix of an attribute_reference (or a range_attribute_reference) has to be resolved without using any context. However, in the case of the Access attribute, the expected type for the prefix has to be a single access type, and if it is an access-to-subprogram type, See section 3.10.2 Operations of Access Types, then the resolution of the name can use the fact that the profile of the callable entity denoted by the prefix has to be type conformant with the designated profile of the access type.

    Examples

  15. Examples of attributes:
  16. Color'First
    -- minimum value of the enumeration type Color   See section 3.5.1 Enumeration Types
    
    Rainbow'Base'First
    -- same as Color'First                           See section 3.5.1 Enumeration Types
    
    Real'Digits
    -- precision of the type Real                    See section 3.5.7 Floating Point Types
    
    Board'Last(2)
    -- upper bound of the second dimension of Board  See section 3.6.1 Index Constraints and Discrete Ranges
    
    Board'Range(1)
    -- index range of the first dimension of Board   See section 3.6.1 Index Constraints and Discrete Ranges
    
    Pool(K)'Terminated
    -- True if task Pool(K) is terminated            See section 9.1 Task Units and Task Objects
    
    Date'Size
    -- number of bits for records of type Date       See section 3.8 Record Types
    
    Message'Address
    -- address of the record variable Message        See section 3.7.1 Discriminant Constraints
    


Go to the first, previous, next, last section, table of contents.