Description
There may be a reason why the standards committee has chosen not to allow this, but I've found it very irritating that a proc-component-ref (R1039 in the draft 2018 standard) requires that the variable on the left-hand-side of the %
character be a data-ref (according to C1027). This prevents type-bound function calls being performed on function results, as can be done in pretty much every other object-oriented language. Thus, the following code is illegal:
var = object%get_another_object()%get_yet_another()
Instead, something along the lines of
tmp = object%get_another_object()
var = tmp%get_yet_another()
is required. This is more verbose, especially as you try to chain more and more function calls together. Is there any reason for this restriction?
I would propose changing this. The definition of proc-component-ref
could stay the same as before:
R1039 proc-component-ref is scalar-variable % procedure-component-name
but C1027 ("the scalar-variable shall be a data-ref that is not a coindexed object") would be amended to
the scalar-variable shall not be a coindexed object.