News for hackers. Stuff that matters.
Re:Translate Fortran to C++ with AI and RAG by almostgotcaught on Saturday April 19, 2025 @09:22PM (#43740839)
What is the point of this? Fortran is both faster than cpp and easier to write than cpp. It's also by no means a dead or dying or whatever language. Smells like literally "your scientists were so busy they forgot to ask why".
Re:Translate Fortran to C++ with AI and RAG by jandrewrogers on Saturday April 19, 2025 @10:23PM (#43741079)
Seems pretty obvious to me, and I’ve written my fair share of both Fortran and C++. I think it is mostly that very few people know Fortran anymore and even fewer people want to maintain it. A vast number of people in 2025 will happily work in C++ and are skilled at it.

Fortran also hasn’t been faster than C++ for a very long time. This was demonstrable even back when I worked in HPC, and Fortran can be quite a bit worse for some useful types of performance engineering. The only reason we continued to use it was that a lot of legacy numerics code was written in it. Almost all new code was written in C++ because it was easier to maintain. I actually worked in Fortran before I worked in HPC, it was already dying in HPC by the time I got there. Nothing has changed in the interim. If anything, C++ is a much stronger language today than it was back then.

Re:Translate Fortran to C++ with AI and RAG by walleeee on Saturday April 19, 2025 @10:43PM (#43741149)
> Almost all new code was written in C++ because it was easier to maintain.

What makes you say so? See musicale's comment above. I have a hard time seeing C++ as easier to maintain, if we are just talking about the language. The ecosystem is a different story.

Re:Translate Fortran to C++ with AI and RAG by jandrewrogers on Saturday April 19, 2025 @11:16PM (#43741274)
For pure number crunching, Fortran is nicer. Unfortunately, performance for most codes became about optimizing memory bandwidth utilization at some point in the 2000s, and systems languages are much more effective at expressing that in a sane way. It was easier to make C/C++ do numerics code than to make Fortran do systems code. Some popular HPC workloads were also quite light on numerics code generally, being more about parallelization of data processing.

This was before modern C++ existed, so most of the code was “C with classes” style C++. If you can read C then you can read that code. I don’t consider that to be particularly maintainable by modern standards but neither is Fortran.

Modern C++ dialects, on the other hand, are much more maintainable than either. Better results with a fraction of the code. The article doesn’t say but I would expect at least idiomatic C++11, if not later dialects.

Re:Translate Fortran to C++ with AI and RAG by pjmlp on Sunday April 20, 2025 @01:35AM (#43741730)
Fortran is still quite modern despite its age, and relevant enough that not only has one of the success factors of CUDA, the availability of Fortran on the CUDA SDK, LLVM project also started a Fortran frontend project.

Also to me seems more likely that people that enjoy Fortran in HPC are more likely to change to Chapel than use C++.

Re:Translate Fortran to C++ with AI and RAG by jeffbee on Saturday April 19, 2025 @09:57PM (#43740987)
I wonder if they feel that the toolchains are just rotting.
Re:Translate Fortran to C++ with AI and RAG by almostgotcaught on Saturday April 19, 2025 @10:10PM (#43741038)
Re:Translate Fortran to C++ with AI and RAG by xvilka on Sunday April 20, 2025 @02:29AM (#43741921)
Unlike C++, they even got their standard package manager - fpm[1].

[1] https://fpm.fortran-lang.org/

Re:Translate Fortran to C++ with AI and RAG by pjmlp on Sunday April 20, 2025 @03:47AM (#43742218)
Disinformation, it is as standard as vcpkg and conan.

ISO Fortran does not acknowledge the existences of FPM, just like any programming language ISO standard, the ecosystem is not part of the standard.

Re:Translate Fortran to C++ with AI and RAG by mkoubaa on Saturday April 19, 2025 @09:32PM (#43740875)
This. If someone can't correctly articulate the advantages of Fortran they shouldn't be migrating away from it. This is not to say that migrations should never happen.
Re:Translate Fortran to C++ with AI and RAG by greenavocado on Saturday April 19, 2025 @09:48PM (#43740947)
Chesterton's Fence
Re:Translate Fortran to C++ with AI and RAG by jabl on Sunday April 20, 2025 @01:53AM (#43741802)
Some people at LANL seem to be on a holy crusade to replace Fortran with C++. They occasionally produce stuff like papers saying Fortran is dying and whatever. Perhaps it makes sense for their in-house applications and libraries, but one shouldn't read too much into it outside their own bubble.