In a thread at comp.lang.fortran, OP posts a plan to “convert” the FORTRAN sections of a commercial chemical process simulation code to C++ starting with F2C tool.
The ensuing discussion brings up some of the challenges of working with modern Fortran on Windows. OP states:
“The problem that I have run into in modern Fortran is that there is not a good IDE (interactive development environment) on Windows”
“I tried Visual Studio 2019 with Intel Fortran and Visual C++ and was very unhappy with the poor integration of Intel Fortran into the IDE.” Attention @greenrongreen
As I have indicated on this forum and at comp.lang.fortran and the Intel forum, this is a major issue with modern Fortran in the Enterprise domain (e.g., large companies such as Bayer, BASF, DuPont, Dow, Exxon, Shell, Linde, etc. and the commercial software vendors such as WinSim, Inc. who sell products and services to them) where Windows OS is the primary or the sole OS platform for computations even.
It will be really cool if anyone in this Community has ideas and solutions with such challenges.
I am obviously biased on this but I think that VS Code + Modern Fortran + fortls make for a good development environment that in many aspects is more capable in terms of Fortran support, than VS. The main problem I can identify with my proposed solution is that Intel compilers do not have a debug adapter for Windows so you have to rely on GDB for debugging, see this post I made a while back that did not have any real engagement about the issue:
Relying on GDB for debugging comes with some challenges, I identified some of them in this thread and why it is in the best interest of Intel and the other compiler vendors to aid in resolving them
In general, the thing drastically improves the coding experience are features provided by the Language Server Protocol. VS is lacking a modern extension for integration with the fortls Language Server, currently the only language server in active development, and hence it’s stuck in its current state.
I don’t have free time to develop such an extension as a side project, but someone else in Fortran-lang could probably do so.
Seems like I’m in a similar situation as the com.lang.fortran OP. I’m also working on a team that develops and maintains a reasonably large computational engine written mainly in Fortran. It’s about 700k lines of Fortran code ranging from very old to very modern targeting both Linux and Windows. The software is sold commercially and used by companies similar to those OP mentions.
First of all I find OPs approach to refactoring a bit odd. Refactoring to C++ just for the sake of refactoring won’t provide any value to their customers. No matter how ugly the code is it doesn’t matter if you have some legacy fixed format FORTRAN laying around as long has you don’t have to change it. I find that the art of successful code refactoring is a balancing act. One need to incrementally improve the architecture while still maintaining a pragmatic approach while providing customer value through fixing bugs and adding new features. Using f2c to convert code doesn’t fix bugs, add features nor improve the architecture. It just changes the programming language. Spending a whole release cycle just refactoring won’t give the customers any value and in the end that’s what they pay you for.
Now my experience with C++ is quite limited, but I find VSCode and Modern Fortran to be a better IDE experience VSCode and C++ IntelliSense! Maybe it’s just me that have set things up the wrong way, but the C++ language server keeps crashing on me at random. Autocomplete takes FOREVER to compute suggestions so it’s usually quicker to just navigate to the relevant struct and see if I remembered the name correctly. I never use renaming as it tries to analyze my whole project even if the variable I’m renaming is a local one! Maybe Visual Studio is better for C++ I haven’t tried that. The non-IDE functionality in VSCode is just so much better that I’d rather not open that application…
Meanwhile I can’t really remember the last time fortls crashed on me. It consistently gives me decent autocomplete suggestions and local variable renaming works every time. Yes there are things that’s missing or could be improved, but a lot is there already. What VSCode + Modern Fortran on Windows really is lacking is a solid debugging experience like @gnikit mentioned.
FWIW a friend that last year started working, as a junior C++ developer, on a large full-stack software (it has a GUI, it involves audio processing, etc), has detailed me a lot of trouble with the C++ extensions for VS code and with Visual Studio too. So much that he ditched everything and moved to Qt Creator, which he keeps telling me to give a fantastic experience with C++ (+Qt for the GUI, so probably there’s an obvious bias to account for). So I guess we might want to avoid taking the VS/Vscode C++ experience as a model.
Nevertheless I find myself very very happy with fortls and modern fortran extension on vs, I fell it never failed me so far. I came from heavy matlab usage, so I assume I was neither too spoiled nor too clueless about a good IDE experience.
What I sometimes miss quite a bit is a good experience with both debugging and (much more even) profiling, which fairly enough are probably the only two points where Matlab really ranks as best in class. (well also interactive stuff, but that’s out of scope here, for now).
Probably profiling is too much to ask for in modern fortran extension though, at some point we should work on a good profiler per se and then see how to make it easy to work with within the VScode extension (pretty as much as the current status with gdb).
I find visual studio with intel one api fortran a very good IDE for debugging in modern fortran on a Windows machine. It used to be very expensive but now it’s free. What I like the most about it is that you can set breakpoints and step through the code very easily. You can also inspect variables in smth called immediate window in the bottom right of the screen.
Given that now intel one api fortran with VS is free, what are the advantages of using VS code?
As the developer of Simply Fortran, which started as a Windows-only IDE, I would say that this space can be challenging. Our IDE doesn’t show up on a lot of people’s radars because we are a small operation, but Windows functionality without any compromises has always been a primary goal.
I’ve worked with the original poster from comp.lang.fortran a bit in the past. Some of the issues that they and others have discussed are how an IDE “works.” Our IDE doesn’t attempt to replicate the workflow and functionality of, well, any other product at this point. Often people approach it asking why we don’t offer, for example, multiple build profiles per project (a complicated concept if you’re not looking for or familiar with that feature) or solutions containing multiple projects (we offer a different “dependent project” structure instead).
Additionally, the original poster was looking for a good Fortran and C++ experience, which we don’t really offer (our C++ support is definitely lacking). IDEs with great support for multiple, disparate languages eventually lead to compromises, sometimes hurting support for another language, like how the original poster described Visual Studio’s Fortran support falling short of their expectations.
I think saying there aren’t any good Fortran IDEs on Windows is misleading. There are quite a few, actually. I think it really depends on what you’re looking for specifically. Expectations of how a IDE should look and behave, though, definitely drive opinions in this space.
As a Fortran user, unfortunately I don’t have experience with many IDEs, so feel unqualified to identify a “good” IDE.
Those I have used are probably fairly basic, with colour marking of reserved words and code blocks (DO, IF).
The feature I would like to see is implicit INTERFACE checking, as I consider explicit INTERFACE definition in Fortran should be removed from the language, replaced by the compiler generating this definition. (which would require a linking definition). This becomes more complex when 3rd party libraries are being used.
I find subroutine and function argument checking to be a major issue, especially during program development. This is best managed via contained routines, rather than explicit INTERFACE definition.
Do any IDE’s provide a routine interface checking and assessment reporting feature ?
Adding a capability for assessing F77 wrapper style calls would be more complex, such as with an inclusion of memory usage checking for array arguments.
Perhaps there are good Fortran IDE’s with this capability ?
What are the other capabilities in a “good” IDE ?