Language Change Specification for Record Introspection & Indexing

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

LCS Number: LCS-2016-069
Version: 1
Date: 04-Jan-17
Status: Draft
Author: Brent Hayhoe
Email:  
Source Doc: Record Introspection & Indexing
Summary: Definition of an attribute to enable introspection of record types

Voting Results: Cast your votes here

  • Yes:
    1. Brent Hayhoe - 2017-01-04 - 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 3.2.3 Predefined attributes of arrays

page 243 top

Replace the LRM 3.2.3 title with:

16.2.3 Predefined attributes of arrays composites


Insert new title after LRM 3.2.3 title:

16.2.3.1 Predefined attributes of arrays

page 245 top

Insert new title before LRM 3.2.4 title:

16.2.3.2 Predefined attributes of records

An implicit enumerated type E is declared whenever a record type R is declared, such that each enumerated 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).

Annot: how to access record element path with an enumerated type?


selected_name ::= prefix . suffix

suffix ::=
     simple_name
   | character_literal
   | enumeration_identifier
   | operator_symbol
   | all

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 enumerated 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 dimensionality of R. If omitted, it defaults to 1.
Result type: The implicit enumerated type E.
Result: E'POS(N).
R'LEFT [(N)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype whose index ranges are defined by a constraint.
Parameter: A locally static expression of type universal_integer, the value of which shall not exceed the dimensionality of R. If omitted, it defaults to 1.
Result type: The implicit enumerated type E.
Result: E'LEFT(N).
R'RIGHT [(N)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype whose index ranges are defined by a constraint.
Parameter: A locally static expression of type universal_integer, the value of which shall not exceed the dimensionality of R. If omitted, it defaults to 1.
Result type: The implicit enumerated type E.
Result: E'RIGHT(N).
R'HIGH [(N)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype whose index ranges are defined by a constraint.
Parameter: A locally static expression of type universal_integer, the value of which shall not exceed the dimensionality of R. If omitted, it defaults to 1.
Result type: The implicit enumerated type E.
Result: E'HIGH(N).
R'LOW [(N)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype whose index ranges are defined by a constraint.
Parameter: A locally static expression of type universal_integer, the value of which shall not exceed the dimensionality of R. If omitted, it defaults to 1.
Result type: The implicit enumerated type E.
Result: E'LOW(N).
R'RANGE [(N)] Kind: Range.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype whose index ranges are defined by a constraint.
Parameter: A locally static expression of type universal_integer, the value of which shall not exceed the dimensionality of R. If omitted, it defaults to 1.
Result type: The type of the Nth index range of A.
Result: The range R'LEFT(N) to R'RIGHT(N) if the Nth index range of A is ascending, or the range R'LEFT(N) downto R'RIGHT(N) if the Nth index range of A is descending. (If A is an alias for an array object, then the result is determined by the Nth index range from the declaration of A, not that of the object.)
R'REVERSE_RANGE [(N)] Kind: Range.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype whose index ranges are defined by a constraint.
Parameter: A locally static expression of type universal_integer, the value of which shall not exceed the dimensionality of R. If omitted, it defaults to 1.
Result type: The type of the Nth index range of A.
Result: The range R'RIGHT(N) downto R'LEFT(N) if the Nth index range of A is ascending, or the range R'RIGHT(N) to R'LEFT(N) if the Nth index range of A is descending. (If A is an alias for an array object, then the result is determined by the Nth index range from the declaration of A, not that of the object.)
R'LENGTH [(N)] Kind: Function.
Prefix: Any prefix R that is appropriate for a record object, or an alias thereof, or that denotes a record subtype whose index ranges are defined by a constraint.
Parameter: A locally static expression of type universal_integer, the value of which shall not exceed the dimensionality of R. If omitted, it defaults to 1.
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 whose index ranges 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

Edit | Attach | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 2017-01-10 - 11:14:39 - 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