"Corresponding" predefined operation of a derived type AI-00567/01 1 88-09-02 BI RE | !standard 03.04 (06) 88-09-02 AI-00567/01 !class binding interpretation 88-07-06 !status received 88-07-06 !topic "Corresponding" predefined operation of a derived type !summary 88-07-06 !question 88-07-06 !recommendation 88-07-06 !discussion 88-07-06 | !appendix 88-07-11 ***************************************************************************** !section 03.04 (06) Norman Cohen 88-05-04 83-00968 !version 1983 !topic "Corresponding" predefined operation of a derived type Certain predefined operators have an operand that is always of type INTEGER. These are fixed-point-INTEGER multiplication and division (4.5.5(7)) and exponentiation (4.5.6(5)). 3.4(6) states, "For each enumeration literal or predefined operator of the parent type there is a corresponding operation for the derived type." Please confirm (or bindingly interpret) the following: 1. For the predefined operators described above, the "corresponding operation" of the derived type has a corresponding operand that is necessarily of type INTEGER. Thus, given the declaration type NI is new INTEGER; the operator corresponding to the parent-type operator function "**" (LEFT, RIGHT: INTEGER) return INTEGER; is function "**" (LEFT: NI; RIGHT: INTEGER) return NI; and not function "**" (LEFT, RIGHT: NI) return NI; (3.4(13), which states, "The specification of a derived subprogram is obtained implicitly by systematic replacement of the parent type by the derived type in the specification of the derivable subprogram," does not apply here because, by 3.4(11), derivable subprograms must be either explicitly declared or derived from a derivable subprogram.) "Corresponding" predefined operation of a derived type AI-00567/01 2 88-09-02 BI RE 2. Except for the special case function "**" (LEFT, RIGHT: INTEGER) return INTEGER; (in which LEFT happens to be of type INTEGER), the predefined operators described above are not to be considered "predefined operators of the parent type" in the sense of 3.4(6) when the parent type is INTEGER. Thus, if there is a predefined operator function "**" (LEFT: LONG_INTEGER; RIGHT: INTEGER) return LONG_INTEGER; the declaration type NI is new INTEGER; does not cause the following operation to be derived: function "**" (LEFT: LONG_INTEGER; RIGHT: NI) return LONG_INTEGER; (3.3.3(1) states, "The set of operations of a type includes the explicitly declared subprograms that have a parameter or result of the type...," but 3.3.3(2), which states that predefined operators are also operations, does not explain when a predefined operation is "an operation of" a given type.) | ***************************************************************************** | | !section 03.04 (06) Norman Cohen 88-07-11 83-00987 | !version 1983 | !topic Addendum to comment 83-00968 (AI-00567) | | By analogy to point (2) of the comment, the "special" multiplying | operators described in 4.5.5(9), taking two fixed-point operands and | returning a universal_fixed result, are not to be considered "predefined | operators of the parent type" in the sense of 3.4(6) when the parent type | is a fixed-point type. Thus, if there is a predefined operator | | function "*" | (LEFT: FPT1; RIGHT: FPT2) return universal_fixed; | | (where FPT1 and FPT2 are fixed-point types), the declaration | | type NFPT1 is new FPT1; | | does not cause the following operation to be derived: | | function "*" | (LEFT: NFPT1; RIGHT: FPT2) return universal_fixed; | | Such a multiplication operation does indeed exist, but it is declared "Corresponding" predefined operation of a derived type AI-00567/01 3 88-09-02 BI RE | presciently in STANDARD (see paragraph 11 of Annex C) rather than | derived.