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

Suggestion for setting up valid programs #1

Open
arjenmarkus opened this issue May 27, 2022 · 0 comments
Open

Suggestion for setting up valid programs #1

arjenmarkus opened this issue May 27, 2022 · 0 comments

Comments

@arjenmarkus
Copy link
Member

Note: thinking out loud here!
One of the things that may be tricky if you allow people to type in fragments of Fortran programs is that such programs need a particular structure. For instance: a DO-loop has a start and an end. That can be helped by having the editor insert the end-statement automatically. It becomes a bit trickier when you have declarations of variables and perhaps use statements to pull in functionality. I was thinking of using the BLOCK construct to allow some flexibility. The user puts in some statements and the editor surrounds this with a BLOCK construct for a new scope. I am not sure how this would work out, but consider the following demonstration program:

! block_use.f90 --
!     Can you put a USE statement in a BLOCK construct?
!
program run_example
implicit none

write(*,*) 'First line ...'

block
    use iso_fortran_env

    write(*,*) 'Value of "OUTPUT_UNIT": ', output_unit
end block
end program run_example

The BLOCK construct seems to work in much the same way as subroutines or programs (with the exception of the IMPLICIT NONE statement).

Like I said, I am thinking out loud here. Using such a block construct would allow the user to combine program fragments without having to worry about the right ordering of declarations and so on.

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

1 participant