Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PierUgit opened this issue Sep 22, 2024 · 1 comment
Open

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

PierUgit opened this issue Sep 22, 2024 · 1 comment

Comments

@PierUgit
Copy link
Contributor

PierUgit commented Sep 22, 2024

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.

@PierUgit PierUgit changed the title Makind DO loop syntax consitent with the DO CONCURRENT one Makind DO loop syntax consistent with the DO CONCURRENT one Sep 22, 2024
@PierUgit PierUgit changed the title Makind DO loop syntax consistent with the DO CONCURRENT one Making DO loop syntax consistent with the DO CONCURRENT one Sep 22, 2024
@certik
Copy link
Member

certik commented Sep 22, 2024

Yes, I know I've seen this exact proposal before, but can't find it right now so we'll leave this open. Yes, going from serial do to concurrent do requires changing the syntax, which is very annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants