Modern editor technologies for improving fortran work ergonomics

Sometimes when I write things quickly, I don’t like to bother with type declarations. Python is nice in that regard. Fortran isn’t too bad and sometimes the good old implicit typing can help there. Yes, it is bad practice at the moment and thus maybe the rules could be improved. There are many other “little” things that could be improved, like (multi) line continuation or comments.

However, I am more and more impressed by modern editor technologies. They can increase work ergonomics. And I think they could help here.

For example, as a user I would like to just write

array=[1,2,3]
print *,array
end

Then in my editor, that is nvim in my case, I would have a key bind <leader>\ft (as in fix type) this would send my code to some external program (so that the same could be applied to any editor) that would fix my code to

integer, allocatable :: a(:)
array=[1,2,3]
print *,array
end

Of course, the type is ambiguous some times so some preferred settings should be in place by the user.

The great thing about this is that the users would have all the work ergonomics possible without bothering the standards committee about small things.

Maybe there already exists workflows like this that I am not aware of. Let me know and let me know your comments.

Feel free to chime in with other little improvements that could make coding easier and safer!

1 Like

OK, I admit it, I am using co-pilot in Visual Studio, and I find that I am getting better at writing comments which result in co-pilot generating correct code, but it is also possible co-pilot is getting better too.

I also admit that sometimes, when co-pilot gets things very wrong, I find myself wondering how or why it got things so wrong, and this process can be quite illuminating sometimes and completely baffling otherwise.

Being a bit of a pedant, I am also finding fortitude a “stern but fair” task master, there is a separate thread for fortitude which I may, or may not, have successfully linked to.

I love how quickly this technology is developing, and admire the people developing it.

4 Likes