To: J3 J3/18-134 From: Damian Rouson Subject: Subject: Type- or object-bound function invocation on, or subobject of, a function reference Date: 2018-February-14 Description =========== Type- or object-bound function invocation ----------------------------------------- Users must currently declare and define a named object in order to invoke a type-bound function or object-bound pointer function component on a function reference: type foo contains procedure :: _function procedure :: another_function end type type(foo) :: temp,a,b temp = a%some_function() b = temp%another_function() The same issue arises if another_function() is object-bound (as defined by a procedure pointer component). If it were possible to invoke a function on a function reference, then a more compact equivalent of the above code might be type(foo) :: a,b b = a%some_function()%another_function() Subobject reference -------------------- Likewise, a user must declare and define a named object in order to reference a subobject of a function reference: type foo real :: real_component contains procedure :: scalar_object_result procedure :: object_array_result end type type(foo) :: object, temp_object type(foo), allocatable, dimension(:) :: temp_object_array real :: desired_real_scalar real, allocatable :: desired_real_array(:) temp_object = object%scalar_object_result() desired_real_scalar = temp_object%real_component temp_object_array = object%object_array_result() desired_real_array = temp_object_array(2:3)%real_component If it were possible to access a subobject of a function reference, then the latter assignments would not require a named temporary and could become desired_real_scalar = object%scalar_object_result()%real_component desired_real_array = object%object_array_result()(2:3)%real_component Opinion within the Data subgroup is split. The feature is seen as being worthwhile if the cost to implementors is not high.