25 June 2000  Page 1 of 2  J3/00-245

Subject: A few small problems with procedure pointers From: Van Snyder

1 Introduction

Maybe I should stop reading 7.5.2. Every time I do, I find problems with pointer assignment – this time mostly with the constraints. The general problem is that “type” is used without qualifying it to the case of data pointers. The term “type” is also apparently intended to refer to the result type specified in the interface for procedure pointers or procedures, but that’s not the same as the type of the pointer – procedure pointers don’t have types. The constraints would also be easier to understand, and could be simplified slightly, if they were grouped according to whether they apply to all pointer assignments, only for data, or only for procedures.

2 Edits

Edits refer to 00-007r2. Page and line numbers are displayed in the margin. Absent other instructions, a page and line number or line number range implies all of the indicated text is to be replaced by immediately following text, while a page and line number followed by + indicates that immediately following text is to be inserted after the indicated line. Remarks for the editor are noted in the margin, or appear between [ and ] in the text.

[Editor: Before “an” insert “is a data object that is”. This edit makes the constraint more 136:10 precise; it may not be necessary, because a procedure pointer, even one that returns an array, is not an array. Nonetheless, it is helpful.]

[Editor: Move the constraint at [136:23] to here.] 136:10+ The following constraints apply only if pointer-object is not a procedure pointer:

The next constraint is intended to replace the one at [136:34-35], which is defective in not including “procedure pointer” in the conditions for target.)

Note to J3 Not an edit

Constraint: The target shall not be a procedure-name, a procedure pointer, or an expr that returns a procedure pointer.

[Editor: Replace “If ... object,” by “The”.] 136:13

[Editor: Replace “If ... it” by “The pointer-object” and insert “the” before “target”.] 136:15

[Editor: Delete – Replaced in the edit for [136:34-35] below.] 136:19-20

The following constraints apply only if pointer-object is a procedure pointer: 136:22 [Editor: After making the changes indicated for [136:30] below, move the constraint at [136:30-33] to here.]

[Editor: Remove “is ... that”. Before “the” insert “target shall have an explicit interface, and”.] 136:24

[Editor: Delete – Replaced in the edit for [136:34-35] below.] 136:28-29

[Editor: Replace “If ... pointer,” by “The”. Replace “an” by “a nonelemental”.] 136:30

[Editor: The constraint at this place is superceded by one introduced by the edit for [136:10+] 136:34-35 above. Replace it by the following:] Constraint: If pointer-object is a subroutine procedure pointer, target shall not be a function, a

function procedure pointer, or an expr that returns a function procedure pointer.

Constraint: If pointer-object is a function procedure pointer, target shall not be a subroutine, a subroutine procedure pointer, or an expr that returns a subroutine procedure pointer.

It would at first seem that the above two upside-down and inside-out constraints could be simpler, but we have procedure pointers and external entities that are neither known to be subroutines nor known to be functions. The constraints are also not covered by the one at [136:24-27] because that one applies only if the pointer-object has explicit interface.

Note to J3 Not an edit

Constraint: If pointer-object is a function procedure pointer and a result type is specified for target, the characteristics of the result types (12.2.2), other than the values of nonkind type parameters, shall be the same.

J3 internal note Unresolved issue xxx Either the polymorphicity of function results needs to be a characteristic (in 12.2.2), or another constraint is needed: Constraint: If pointer-object is a function procedure pointer and a result type is specified for

target, the result of pointer-object shall be polymorphic if and only if the result of target is polymorphic.

[Editor: After “pointer-object” insert “is a data object that” twice.] 136:43,45

[Editor: Replace “If target is a disassociated pointer” by:] 137:1 If pointer-object is a data object or a function procedure pointer, the following conditions apply. In the case of a function procedure pointer, the term “type” applies to the result type of the function.

• When target is a disassociated pointer or an expression the result of which is a disassociated pointer

[Editor: Replace “Otherwise” by:] 137:3

• When target is an associated pointer or an expression the result of which is an associated pointer

[Editor: Put a bullet in front of “If”.] 137:6

[Editor: An expr doesn’t have an association status. After “status” insert “nor shall the result 137:7 of expr have undefined association status”.]

[Editor: Before “becomes” insert “that is a data object”.] 137:22