To: J3 08-281r1 From: Malcolm Cohen Subject: Interpretation of intrinsics EXTENDS_TYPE_OF and SAME_TYPE_AS Date: 2008/11/nn 1. Introduction It is a familiar occurrence to anyone involved in answering customer inquiries and demands that frequently the question asked is several steps removed from the problem the customer actually has. By mental telepathy, it is my surmise that this interpretation question really arises from the wish to use SAME_TYPE_AS and EXTENDS_TYPE_OF not merely on unlimited polymorphics (and it is reasonably clear from the standard that that is allowed), but on ones that potentially have a dynamic type that is not extended. As they are currently described, this is not permitted. The revised answer makes a very small increase in the functionality of these two intrinsics, so is compatible whichever way the interp gets answered, and is clearly desirable for some users. Therefore edits are supplied for the F2008 draft. 2. The revised interpretation answer. ---------------------------------------------------------------------- NUMBER: F03/0125 TITLE: Definitions of EXTENDS_TYPE_OF and SAME_TYPE_AS KEYWORDS: EXTENDS_TYPE_OF SAME_TYPE_AS DEFECT TYPE: Clarification STATUS: J3 consideration in progress QUESTION: The arguments of EXTENDS_TYPE_OF and SAME_TYPE_AS are required to be of extensible type. Does this restriction apply to the declared type, the dynamic type, or both? ANSWER: This restriction was intended to apply to the dynamic type; this is clear from the existing text. However, the restriction is stronger than required or useful, and so an edit is supplied to weaken it. DISCUSSION: For EXTENDS_TYPE_OF, this is clear from the Result Value paragraph which explicitly specifies the result when either the A or MOLD argument to the intrinsic is unlimited polymorphic. For SAME_TYPE_AS, this is clear from Note 13.17 which explains how to work out the result when one or both arguments is a disassociated pointer (or unallocated allocatable), including that of an unlimited polymorphic entity. However, in the case of unlimited polymorphic, it is unreasonable to require the program to somehow know that the dynamic type is extensible; these functions should return the right result whenever either argument is of extensible type, and otherwise it should be processor dependent, i.e. the restriction should be weakened. EDITS: [316:16-17] In 13.7.38, EXTENDS_TYPE_OF, arguments A and MOLD, after "of extensible" change "type" to "declared type or unlimited polymorphic", twice. [316:21] Change "otherwise" to "if the dynamic type of A or MOLD is extensible,". [316:22] At the end of the sentence insert "; otherwise the result is processor dependent". [347:30,348:1] In 13.7.101, SAME_TYPE_AS, arguments A and B, after "of extensible" change "type" to "declared type or unlimited polymorphic", twice. [348:3] Change "The" to "If the dynamic type of A or B is extensible, the" [348:4] Append new sentence to paragraph "If neither A nor B have extensible dynamic type, the result is processor dependent." SUBMITTED BY: John Reid HISTORY: 08-281 m186 Submitted 08-281r1 Revised ---------------------------------------------------------------------- 3. Edits to 08-007r2 [346:13.7.60p3 EXTENDS_TYPE_OF, Arguments] After "of extensible" change "type" to "declared type or unlimited polymorphic", twice. [346:13.7.60p5 EXTENDS_TYPE_OF, Result Value] Change "otherwise" To "if the dynamic type of A or MOLD is extensible,", At the end of the sentence insert "; otherwise the result is processor dependent". [382:13.7.141p3 SAME_TYPE_AS, Arguments] After "of extensible" change "type" to "declared type or unlimited polymorphic", twice. [382:13.7.141p5 SAME_TYPE_AS, Result Value] Change "The" to "If the dynamic type of A or B is extensible, the" Append new sentence to paragraph "If neither A nor B have extensible dynamic type, the result is processor dependent." ===END===