Skip to content

Making DO loop syntax consistent with the DO CONCURRENT one #338

@PierUgit

Description

@PierUgit

I'm not sure this proposal doesn't already exist, but I can't find it. If it exists, feel free to delete this issue.

It would good to allow for the simple do loop the same syntax as the do concurrent loop, not only for internal consistency of the language, but mainly to allow the on-the-fly declaration of the index:

do (integer :: i = 1:n)
   ...
end do

For an even better consistency, the sequential keyword could be used:

do sequential (integer :: i = 1:n)
   ...
end do

What I am also wondering is if the typing could be implicit... After all, the index is necessarily of the integer type, so there's no need to specify it as long as one just need the default kind:

do sequential (i = 1:n)
! is equivalent to
do sequential (integer :: i = 1:n)

Specifying the type/kind would be requiring only for the non default kinds:

do sequential (integer(kind=int64) :: i = 1:n)

This would mean that the scope of the index would always be limited to the loop, which is a good thing IMO.

This "implicit typing rule" could be extended to the do concurrent statement, as I can't see how it would break anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions