J3/16-171r1 To: J3 Members From: Steve Lionel Subject: F2008 interp: Repeated type-bound procedure binding Date: 2016 May 05 NUMBER: F08/ TITLE: Can a binding name be repeated in a type-bound declaration? KEYWORDS: Generic, generics, type-bound procedures DEFECT TYPE: STATUS: J3 consideration in progress QUESTIONS: The standard has many places where it specifies that a name or attribute cannot be given more than once, but some situations are not covered. Q1: Consider: type :: len_test_type integer, private :: bdata contains generic :: my_get => get, get, put ! (A) generic :: my_get => put ! (A) procedure :: get => lmit_get procedure :: put => lmit_put, put => lmit_put (B) end type len_test_type Consider the repetition of binding-name "get" and "put" in (A): C472 says "Each binding-name in binding-name-list shall be the name of a specific binding of the type.", but that is satisfied here. C514 says "An entity shall not be explicitly given any attribute more than once in a scoping unit." which usually covers such things, but it discusses attributes only, and being a binding name in a generic declaration isn't an attribute. Was this repetition intended to be permitted? Q2: Was the repetition of the binding-name "lmit_put" at (B) intended to be permitted? Consider also that a specific binding can be inherited. For example: type t contains procedure p generic :: g => p end type type,extends(t) :: t2 contains generic :: g => p ! BAD - t2 already inherited this end type ANSWER: A1: No, it was not intended to be permitted. 4.5.5p7 says "Each additional GENERIC statement with the same generic-spec extends the generic interface." Whether a separate GENERIC statement is used or if multiple binding-names appear on a single GENERIC statement, the appearance of a binding name extends the generic interface, but a duplicate name can't do that. Also, C1209 in 12.4.3.1 (Interface block) says "A procedure-name shall not specify a procedure that is specified previously in any procedure-stmt in any accessible interface with the same generic identifier.", which imposes a restriction on generic interface blocks. An edit to correct this is supplied. A2: No, it was not intended to be permitted. An edit to correct this is supplied. EDITS to 10-007r1: [73:16+, 4.5.5] Insert the constraint: "C465+ (R449) Each specific of a type shall be declared by exactly one in the derived type definition." [73:23+, 4.5.5] Insert the constraint: "C467+ (R450) A in a type-bound GENERIC statement shall not specify a specific binding that was inherited or specified previously for the same generic identifier in that derived type definition." EDITS to 16-007r1: [75:16+, 4.5.5] Insert the constraint: "C470+ (R450) Each specific of a type shall be declared by exactly one in the derived type definition." [75:23+, 4.5.5] Insert the constraint: "C472+ (R451) A in a type-bound GENERIC statement shall not specify a specific binding that was inherited or specified previously for the same generic identifier in that derived type definition." SUBMITTED BY: Steve Lionel HISTORY: yy-nnn m210 F08/nnnn submitted ----------------------------------------------------------------------