J3/99-146 Date: 25th May 1999 To: J3 From: Malcolm Cohen Subject: Unresolved issue 9 1. Introduction In issue 9 Richard Maine makes 2 suggestions: (1) allowing initialisation of objects containing allocatable components (at least to NULL()) and (2) allowing PARAMETERs of these types. I concur. Since this makes TYPE T2 REAL,ALLOCATABLE :: X END TYPE TYPE(T2) :: V => T(NULL()) legal, perhaps TYPE T REAL,ALLOCATABLE :: X => NULL() END TYPE should be legal also (for consistency)? On the other hand, this adds no functionality at all and is an entirely redundant initialization, so I propose NOT adding it. If it is required, edits are required to [43:30-34] at least. 2. A related issue There is an apparent inconsistency in F95 where we have the situation in which a PARAMETER of derived type can be made up of values that cannot themselves be of derived type. I refer of course to POINTERs. It strikes me as significantly weird that given: TYPE T REAL,POINTER :: X END TYPE then TYPE(T),PARAMETER :: A = T(NULL()) is legal but that REAL,POINTER,PARAMETER :: B => NULL() is not legal, even though the second is essentially part of the first. Allowing PARAMETERs of derived types with ALLOCATABLE components in F2002 extends this apparent inconsistency. Therefore I am propose making resolution of this apparent inconsistency into the "new" issue 9. 3. Edits Comments on each edit appear in {}. {Alter constraint to allow parameters of d.t.s with alloc comps} [70:32-33] Delete "a derived-type ... allocatable," {Fix J3 note} [71:23-41] Replace with the first paragraph of my section 2 above. {Alter constraint to allow for allocatables} [71:18] Delete "an allocatable variable,". {Alter another constraint to allow for allocatables} [71:42-43] After "shall have the" insert "ALLOCATABLE or". After "shall not have the" insert insert "ALLOCATABLE or". {Fix text to allow, and provide semantics for, initialization of allocatables} [73:29-30] Replace first sentence with "If is a pointer and is =>NULL(), the initial association status of the pointer is disassociated. If is allocatable and is =>NULL(), the initial allocation status of the allocatable object is confirmed to be not allocated.". {Note that the previous text had a requirement duplicating part of the constraint 71:42-43; I have removed this duplicate requirement.} {Allow NULL() for allocatable components in structure constructors to be considered to be "constant" expressions.} [141:37] After "each" insert "nonallocatable". Replace "no component ... attribute" with "each allocatable component is a reference to the transformational intrinsic function NULL". {The same for initialization expressions.} [143:1-2] After "each" insert "nonallocatable". Replace "no component ... attribute" with "each allocatable component is a reference to the transformational intrinsic function NULL". -- ...........................Malcolm Cohen, NAG Ltd., Oxford, U.K. (malcolm@nag.co.uk)