Language Change Specification for Record Introspection & Indexing

Secondary LCS:

This LCS details changes for an attribute to provide introspection of record types.

LCS Number: LCS-2016-069b
Version: 1
Date: 13-Jan-17
Status: Draft
Author: Brent Hayhoe
Email:  
Source Doc: Record Introspection & Indexing
Summary: Definition of attributes for use with introspection of record types
Related LCS: LCS-2016-069a

Voting Results: Cast your votes here

  • Yes:
    1. Brent Hayhoe - 2017-01-13 - Version 1

  • Abstain:

Details of Language Change:

Key:

  • LRM text is shown between single quotes '... P1076 LRM quoted text ...'
  • Existing LRM text is shown in BLACK coloured font
  • Additional LRM text is shown in RED coloured font
  • Deleted LRM text is shown in RED with strike-through
  • In order to try and emphasize text in italic font:
    • Italic font in existing LRM text is shown in GRAY italic font
    • Italic font in new LRM text is shown in ORANGE italic font
    • Italic font in deleted LRM text is shown in ORANGE with strike-through
  • Editing instructions are shown in GREEN coloured font

LRM 16.2.3 Predefined attributes of arrays

page 243 top

Edit: Replace the LRM 16.2.3 title with:

16.2.3 Predefined attributes of arrays composites


Edit: Insert new title after LRM 3.2.3 title:

16.2.3.1 Predefined attributes of arrays

page 245 top

Edit: Insert new title before LRM 3.2.4 title:

16.2.3.2 Predefined attributes of records

An implicit enumeration type E is declared whenever a record type R is declared, such that each enumeration literal E'POS(n-1) is an identifier identical to the simple name of the nth element of the record type R'NAME(n-1).

R'RECORDS Kind: Type.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype.
Result: The implicit enumeration type E.
R'NAME [(N)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype.
Parameter: A locally static expression of type universal_integer, the value of which shall not exceed the length of E. If omitted, it defaults to 1.
Result type: Implicit type E.
Result: E'POS(N).
R'LEFTOF [(L)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype with element index ranges that are defined by a constraint.
Parameter: An enumeration literal of type E.
Result type: Implicit type E.
Result: E'LEFTOF(L).
Restrictions: An error occurs if Lequals E'LEFT or if L does not belong to the range E'LOW to E'HIGH.
R'RIGHTOF [(L)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype with element index ranges that are defined by a constraint.
Parameter: An enumeration literal of type E.
Result type: Implicit type E.
Result: E'RIGHTOF(L).
Restrictions: An error occurs if Lequals E'RIGHT or if L does not belong to the range E'LOW to E'HIGH.
R'HIGH Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype with element index ranges that are defined by a constraint.
Result type: Implicit type E.
Result: E'HIGH.
R'LOW Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype with element index ranges that are defined by a constraint.
Result type: Implicit type E.
Result: E'LOW.
R'RANGE&nbsp Kind: Range.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype with element index ranges that are defined by a constraint.
Result type: Implicit type E.
Result: The range R'LEFT to R'RIGHT.
R'REVERSE_RANGE Kind: Range.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype with element index ranges that are defined by a constraint.
Result type: Implicit type E.
Result: The range R'RIGHT downto R'LEFT.
R'LENGTH Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype with element index ranges that are defined by a constraint.
Result type: universal_integer.
Result: Number of values in the Nth index range; i.e., if the Nth index range of A is a null range, then the result is 0. Otherwise, the result is the value of T'POS(R'HIGH(N)) T'POS(R'LOW(N)) + 1, where T is the subtype of the Nth index of A.
R'ASCENDING [(N)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype with element index ranges that are defined by a constraint.
Parameter: A locally static expression of type universal integer, the value of which shall be greater than zero and shall not exceed the dimensionality of A. If omitted, it defaults to 1.
Result type: Type BOOLEAN.
Result: TRUE if the Nth index range of A is defined with an ascending range; FALSE otherwise.
R'ELEMENT Kind: Subtype.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype.
Result: If A is an array subtype, the result is the element subtype of A. If A is an array object, the result is the fully constrained element subtype that is the element subtype of A, together with constraints defining any index ranges that are determined by application of the rules of 5.3.2.2. (If A is an alias for an array object, then the result is determined by the declaration of A, not that of the object.)

Comments

This proposal is based on the idea that these attributes can be used within a for-loop. The iterator of a for-loop is not locally static so it's unusable as an argument of an attribute. So, you can add these attributes but you will not achieve your usecase.

-- Lieven Lemiengre - 2017-01-09

Is this the same for arrays as well?

-- Brent Hayhoe - 2017-01-10

Topic revision: r1 - 2017-01-13 - 01:08:12 - BrentHahoe
 
Copyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback