J3/03-144r2 To: J3 From: Malcolm Cohen Subject: Edits for UK comment TC6 (Restrictions on CLASS(*) pointers) Date: 1st April 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}. [33:2] After "argument" insert "; it is also used for an associate name in a SELECT TYPE construct that assumes the type parameter value from the corresponding selector" {Allow our use of * to assume nonkind type paremeters in type guard statements.} [57:16] Change "or" to "of a dummy argument or associate name or in the". {Ditto.} [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 the unsafe pointer component.} [143:34] Append "If is of sequence derived type, the dynamic type of shall be that derived type." [162:16,17] Change "" to "". {TC5, modified} [162:19-20] Replace with "C815a (R823) The shall specify that each length type parameter is assumed. C815b (R823) shall not specify a sequence derived type. C815c (R823) If is not unlimited polymorphic, shall specify an extension of the declared type of ." {TC5, modified} [162:21] Change "" to "type and kind type parameter values". {TC5} [163:6-14. Replace by "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===