Language Change Specification for Attributes for Enumerated Types

LCS Number: LCS-2016-018
Version: 2
Date: 11-Jan-2017
Status: Approved
Author: Patrick Lehmann
Source Doc: Attributes for Enumerated Types
More: Proposal
Examples
LCS History
Summary: Adds new attributes for enumerated types.

Style Notes

Changes are shown in red font.
Deletions are crossed out.
Editing or reviewing notes in green font.

Reviewing Notes

The original proposal requested special attributes for enumerated types. This LCS lifts the demand and adds the demanded attributes
for scalar types in general. See also the related LCS' LCS-2016-018a and LCS-2016-018b for further related improvements, but not covered
by the original proposal.

This LCS also adds a prefix description to all sub-section because the prefix is not properly defined in the current LRM text. It also
splits section 16.2.2 into two parts to distinguish types and objects. This distinction is a) a clean-up and b) needed by other LCS' like
LCS-2016-018b.

NOTE 1 in sub-section 16.2.2 is going to be remove or should be moved to 5.2.1 where it belongs?

Details of Language Change

16.2.2 Predefined attributes of types and objects

[Reviewer note: Extended existing attributes for use with objects.]
PT'BASE Kind: Type
  Prefix: Any type or subtype T.
Any prefix P that is appropriate for an object with type or subtype T, or an alias thereof, or that
denotes any type or subtype T.
  Result: The base type of T.
  Restrictions: This attribute is allowed only as the prefix of the name of another attribute;
for example, P'BASE'LEFT.
 
PT'LEFT Kind: Value
  Prefix: Any scalar type or subtype T.
Any prefix P that is appropriate for an object with a scalar type or subtype T, or an alias thereof,
or that denotes any scalar type or subtype T.
  Result type: Same type as T.
  Result: The left bound of T.
 
PT'RIGHT Kind: Value
  Prefix: Any scalar type or subtype T.
Any prefix P that is appropriate for an object with a scalar type or subtype T, or an alias thereof,
or that denotes any scalar type or subtype T.
  Result type: Same type as T.
  Result: The right bound of T.
 
PT'HIGH Kind: Value
  Prefix: Any scalar type or subtype T.
Any prefix P that is appropriate for an object with a scalar type or subtype T, or an alias thereof,
or that denotes any scalar type or subtype T.
  Result type: Same type as T.
  Result: The upper bound of T.
 
PT'LOW Kind: Value
  Prefix: Any scalar type or subtype T.
Any prefix P that is appropriate for an object with a scalar type or subtype T, or an alias thereof,
or that denotes any scalar type or subtype T.
  Result type: Same type as T.
  Result: The lower bound of T.
 
PT'ASCENDING Kind: Value
  Prefix: Any scalar type or subtype T.
Any prefix P that is appropriate for an object with a scalar type or subtype T, or an alias thereof,
or that denotes any scalar type or subtype T.
  Result type: Type BOOLEAN.
  Result: It is TRUE if T is defined with an ascending range; FALSE otherwise.
[Reviewer note: New attributes.]
P'LENGTH Kind: Pure function
  Prefix: Any prefix P that is appropriate for an object with a discrete or physical type or subtype T,
or an alias thereof, or that denotes any discrete or physical type or subtype T.
  Result type: universal_integer
  Result: T'LENGTH = maximum(0, T'POS(T'HIGH) - T'POS(T'LOW) + 1)
 
P'RANGE Kind: Range
  Prefix: Any prefix P that is appropriate for an object with a scalar type or subtype T,
or an alias thereof, or that denotes any scalar type or subtype T.
  Result type: The type of T.
  Result: The range T'LEFT to T'RIGHT if the range of T is ascending, or the range
T'LEFT downto T'RIGHT if the range of T is descending.
 
P'REVERSE_RANGE Kind: Range
  Prefix: Any prefix P that is appropriate for an object with a scalar type or subtype T,
or an alias thereof, or that denotes any scalar type or subtype T.
  Result type: The type of T.
  Result: The range T'RIGHT downto T'LEFT if the range of T is ascending, or the range
T'RIGHT to T'LEFT if the range of T is descending.
 
T'IMAGE(X) [Not modified]
T'VALUE(X) [Not modified]
T'POS(X) [Not modified]
T'VAL(X) [Not modified]
T'SUCC(X) [Not modified]
T'PRED(X) [Not modified]
T'LEFTOF(X) [Not modified]
T'RIGHTOF(X) [Not modified]
O'SUBTYPE [Not modified]
[Reviewer note: new attributes for objects as a shorthand to existing attributes on types.]
O'IMAGE Kind: Pure function
  Prefix: Any prefix O that is appropriate for an object with a scalar type or subtype, or an alias thereof.
  Shorthand for: O'SUBTYPE'IMAGE(O)
 
O'POS Kind: Pure function
  Prefix: Any prefix O that is appropriate for an object with a discrete or physical type or subtype, or an alias thereof.
  Shorthand for: O'SUBTYPE'POS(O)
 
O'SUCC Kind: Pure function
  Prefix: Any prefix O that is appropriate for an object with a discrete or physical type or subtype, or an alias thereof.
  Shorthand for: O'SUBTYPE'SUCC(O)
 
O'PRED Kind: Pure function
  Prefix: Any prefix O that is appropriate for an object with a discrete or physical type or subtype, or an alias thereof.
  Shorthand for: O'SUBTYPE'PRED(O)
 
O'LEFTOF Kind: Pure function
  Prefix: Any prefix O that is appropriate for an object with a discrete or physical type or subtype, or an alias thereof.
  Shorthand for: O'SUBTYPE'LEFTOF(O)
 
O'RIGHTOF Kind: Pure function
  Prefix: Any prefix O that is appropriate for an object with a discrete or physical type or subtype, or an alias thereof.
  Shorthand for: O'SUBTYPE'RIGHTOF(O)

NOTE 1 - The relationship between the values of the LEFT, RIGHT, LOW, and HIGH attributes is expressed as follows:

    Ascending range Descending range
PT'LEFT = PT'LOW PT'HIGH
PT'RIGHT = PT'HIGH PT'LOW

Topic revision: r34 - 2017-04-02 - 12:19:45 - PatrickLehmann
 
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback