J3/03-144 To: J3 From: UK Fortran panel Subject: Edits for UK comment TC6 (Restrictions on CLASS(*) pointers) Date: 13 March 2003 1. Comment TC6 Allow a CLASS(*) pointer to point to an object of any type, including an intrinsic type. The restrictions are not necessary and exclude useful functionality. An example is for sorting of data of any type for which the ordering operators are defined. One should be able to select for intrinsic types in a SELECT TYPE construct. Pointer assignment should allow to be of a non-extensible derived type when is a pointer of CLASS(*) and has the dynamic type of . 2. Discussion There is an interaction between TC6 and TC7, particularly in the area of SELECT TYPE. Allowing unsafe pointer assignment (the final paragraph above) is only necessary in very restricted situations. As discussed in detail in the paper for UK comment TC7, it is possible and reasonable to allow SELECT TYPE to detect any non-SEQUENCE type (including the intrinsic types). The only types which pose a problem are SEQUENCE types. Therefore the proposal is modified to - allow CLASS(*) to point to an object of any type (including intrinsic types and SEQUENCE types). - allow SELECT TYPE to detect any non-SEQUENCE type (including intrinsic types). - allow (unsafe) pointer assignment only for pointers to SEQUENCE types. All edits from TC5 (to correct errors in SELECT TYPE) are included, with any necessary amendment, in this paper. 3. Edits to 02-007r3 Edits taken verbatim from the "UK comment TC5" paper are marked {TC5}. [67:16] Change "" to "". [67:20] Swap with [67:21]. [67:20-21] Insert between these two lines "R503a <> ". {This subdivides the rule, producing the rule which we want to use later.} [74:2] Delete 'of extensible type'. {Make CLASS(*) type-compatible with everything.} [143:1] Replace "A" with "If is not unlimited polymorphic," Replace "" with "it". [143:2+] Insert "C717a (R735) If is unlimited polymorphic, shall be unlimited polymorphic or of a sequence derived type." {Allow CLASS(*) pointers to be pointer-assigned to pointers of sequence type.} [162:16,17] Change "" to "". {TC5} [162:19-20] Delete. {TC5} [162:21] Change "" to "type and kind type parameter values". {TC5} [162:25+] Insert "R823a <> <> CHARACTER [ ( KIND = ) ] <> [ ( ) ] C815a (R823a) shall be the name of a nonsequence derived type. C815b (R823a) If is not unlimited polymorphic, shall specify an extension of the declared type of . C815c (R823a) There shall be exactly one corresponding to each kind type parameter of the type and none corresponding to a nonkind type parameter." {If UK comment TC3 is accepted, the third new constraint will need to be "C815c (R823a) There shall be exactly one corresponding to each kind type parameter of the type that does not have a default value, at most one corresponding to each kind type parameter of the type that has a default value, and none corresponding to a nonkind type parameter."} [163:6-14. Replace by EITHER "The block to be executed is selected as follows: (1) If the dynamic type and kind type parameter values of the selector are the same as those specified by a TYPE IS type guard statement, the block following that statement is executed. (2) Otherwise, if exactly one CLASS IS type guard statement specifies a type of which the dynamic type of the selector is an extension and specifies kind type parameter values that match the corresponding type parameter values of the dynamic type of the selector, the block following that statement is executed. (3) Otherwise, if several CLASS IS type guard statements match as in (2), one of these statements must specify a type that is an extension of all the types specified in the others; the block following that statement is executed." OR "A TYPE IS type guard statement matches the selector if the dynamic type and type parameter values of the selector are the same as those specified by the statement. A CLASS IS type guard statement matches the selector if the dynamic type of the selector is an extension of the type specified by the statement and the kind type parameter values specified by the statement are the same as the corresponding type parameter values of the dynamic type of the selector. The block to be executed is selected as follows: (1) If a TYPE IS type guard statement matches the selector, the block following that statement is executed. (2) Otherwise, if exactly one CLASS IS type guard statement matches the selector, the block following that statement is executed. (3) Otherwise, if several CLASS IS type guard statements match the selector, one of these statements must specify a type that is an extension of all the types specified in the others; the block following that statement is executed." {TC5} [163:18,21,24] Change 'type parameters' to 'type parameter values' on all three lines. {TC5} [163:22] Replace line by "are the corresponding type parameter values of the selector." {TC5} [425:38] Delete 'of extensible type'. [442:5] Delete "extensible". [442:9] Delete "of extensible type". {C.3.2 example no longer requires extensible types.} ===END===