Skip to content

Remove restrictions on proc-component-ref #27

Open
@cmacmackin

Description

@cmacmackin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Clause 10Standard Clause 10: Expressions and assignmentFortran 202yProposals targeting the standard after F2023unsubmittedHas not been submitted to the committee yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions