J3/03-145r1 To: J3 From: UK Fortran panel Subject: Edits for UK comment TC7 (Extending any non-SEQUENCE type) Date: 1 April 2003 Author: Lawrie Schonfelder 1. Comment TC7 The UK comment was: Allow any non-SEQUENCE type to be extended. There is no technical reason for the requirement that only extensible types can be extended; therefore it should be possible to extend any non-SEQUENCE derived type. However, SELECT TYPE should continue to require that its type guards specify extensible types (or intrinsic types). 2. Discussion The perceived difficulty which underlay the introduction of the EXTENSIBLE keyword was the interaction of previously compiled libraries (in particular, sharable libraries) together with the need for a unique type "signature" for identifying the type of a polymorphic variable. On further reflection, this concern was somewhat of a shibboleth. For an ordinary polymorphic pointer, a "null" signature would suffice to identify the base type. Even in the case of an unlimited polymorphic pointer, there are reasonably effective implementation techniques available. A plausible technique for identifying a type in the absence of a previously compiled type signature is to store a string identifying the scope of the type declaration plus a string identifying the type. Although string comparison is relatively slow (vs. comparing pointers to a type signature block), this would need to be done relatively rarely and in a well-defined situation, viz: (a) the object is unlimited polymorphic (b) the type test is TYPE IS or CLASS IS of a base type that does not have a type signature block. Alternatively, as mentioned in the UK comment, SELECT TYPE could continue to require its type guards to specify extensible types (which always have type signature blocks). This restriction would simplify implementation techniques slightly, at the cost of obstructing the user -- forcing him to keep track of which type an unlimited polymorphic pointer is pointing to (when it is not an extensible type) and to use unsafe pointer assignments. In this case, the EXTENSIBLE keyword should still be kept as it would still be useful. This paper recommends that SELECT TYPE be extended to detect all nonsequence types. 3. Interaction with UK comment TC6 Note that being able to extend any (non-SEQUENCE) derived type implies that CLASS(*) can point to any (non-SEQUENCE) derived type. UK comment TC6 also addresses this area, and proposes that CLASS(*) be allowed to point to objects of any type (i.e. not limited to non-SEQUENCE derived types). 4. Edits to 02-007r3 and 03-166 [42:1] Delete. [42:8] Delete. [42:10] Replace with "C418 (R423) If EXTENDS appears, SEQUENCE shall not appear." {Remove EXTENSIBLE keyword (and attribute), but leave the concept of extensible type. Allow any nonsequence nonBIND type to be extended. Note that for C418, the BIND(C) part was already redundant with C1503.} [53:31+4] Delete ", EXTENSIBLE ::". {Remove EXTENSIBLE keyword.} [56:5] Change "Extensible types" to "Type extension". {Better section title.} [56:6] Replace with "A nonsequence derived type that does not have the BIND attribute is an <>." {New definition of extensibility, i.e. most types.} [56:7] Replace the first sentence with "An extensible type that does not have the EXTENDS attribute is a <>." {Remove EXTENSIBLE attribute.} [57:0+4] Delete ", EXTENSIBLE ::". {Ditto.} [51:4] Change "extensible type" to "extended type (4.5.6)". {Note: This is a mere wording improvement, as only extended types have parent components...} [163:29+3] Delete ", EXTENSIBLE ::". [387:1] Delete "EXTENSIBLE or". [416:2-3] Delete "A ... attribute.". {Glossary entry for base type. This sentence was unnecessary.} [419:25] Replace with "A nonsequence type that does not have the BIND attribute." {Glossary entry for extensible type.} [432:37] Change "Extensible types (4.5.3)" to "Type extension and component accessibility (4.5.1.8, 4.5.3)". {Better title.} [433:1] Delete ", extensible ::". {Type extension example.} [437:22] Delete ", EXTENSIBLE ::". {Final subroutine example.} [441:30] Delete ", EXTENSIBLE ::". {Component access example.} [474:28] Delete ", EXTENSIBLE ::". [477:29] Change "extensible types" to "polymorphic variables". {This sentence was previously misleading.} ===END===