J3/00-154 Date: 9th February 2000 To: J3 From: Malcolm Cohen Subject: Issue 223 1. Introduction Richard says that "section 5.1.1.8 on polymorphic objects could use some cleanup". I concur. It has also been commented on that 5.1.1.8 is a peculiar place to hide away the definition of something as basic as "type-compatible" which is used not only here but also in chapters 7 (for pointer assignment) and 11 (for argument association). However, "type-compatible" is only non-trivial for polymorphic objects (for non-polymorphic "type-compatible".EQV."same type"), so 5.1.1.8 is not an inappropriate location for it; but it should be added to the glossary and index so that it can be found later. It has also come to my attention that the "assumes the type" wording is potentially confusing. I believe the easy way to handle this is to dump much of this wording - just have the dynamic type of a polymorphic object be the type of its associated object; polymorphic allocatables require a few extra words to make this work. I noticed that polymorphic allocatables are currently constrained against, even though there is lots of text in the standard to give them semantics. Edits are supplied to fix this. 2. Edits to 00-007 [42:45] Before "POINTER" insert "ALLOCATABLE or". {Fix erroneous constraint.} [64:19] Before "POINTER" insert "ALLOCATABLE or". {Fix erroneous constraint.} [69:36-37] Delete sentence "A polymorphic ... types.". {We will state this better later.} [69:38] Embolden "type-compatible" and insert it into the index. {Make this the definition of type-compatible.} [69:40] Replace "type-compitable" with "type-compatible". {Fix typos.} [69:40] Add to end of paragraph "An object is said to be type-compatible with a type if it is type-compatible with objects of that type." {This form of type-compatible is used for allocatable entities later on.} [69:41-44] Replace with "A polymorphic allocatable object may be allocated to be of any type with which it is type-compatible. A polymorphic pointer or dummy argument can, during program execution, be associated with objects with which it is type-compatible." {Essentially fix the note and make it normative.} [70:1-10] Delete J3 note 223. [70:11] Replace with "The <> of an allocatable polymorphic object that is currently allocated is the type with which it was allocated. The dynamic type of a polymorphic pointer that is currently associated is the dynamic type of its target. The dynamic type of a nonallocatable nonpointer polymorphic dummy argument is the dynamic type of its associated actual argument. The dynamic type of an unallocated allocatable or a disassociated pointer is the same as its declared type. The dynamic type of an associate name (8.1.4) is the dynamic type of the selector with which it is associated." {Add full, unassuming, definition of dynamic type.} [70:16-18] Delete. {We no longer talk about assuming types.} [70:19] Delete. {Covered by our new definition of dynamic type.} [102:27-30] Replace constraint with "Constraint: If a appears, it shall specify a type with which each is type-compatible." {Simplify complicated old constraint.} [102:32] Delete. {Already covered by constraint at [33:21-22].} [136:34] After "type-compatible" insert "(5.1.1.8)". {Insert cross-reference.} [153:29-30] Delete "and with ... selector". {Now covered by the definition of dynamic type.} [153:32] Change "declared and dynamic types" to "declared type". {Dynamic type now covered by the definition of dynamic type.} [257:8] After "type-compatible" insert "(5.1.1.8)". {Insert cross-reference.} [257:13+] Paper 00-134 says to insert "A polymorphic dummy argument assumes its dynamic type from the dynamic type of the associated actual argument." Instead, insert "On procedure entry, the dynamic type of a polymorphic dummy argument is that of its associated actual argument." {I think this wording reads better, though the 00-134 version is not actually incorrect.} [403:10+] Add new entry "<> (5.1.1.8): All entities are type-compatible with other entities of the same . Unlimited polymorphic entities are type- compatible with all entities of ; other entities are type-compatible with entities whose is an of the entity's ." ===END