3 ms·
I use Fortran for some research codes (I also use Julia and C++). The main advantage of Fortran, to me, is that it is very easy to write very fast code, and has
by archermarks 3y ago
I use Fortran for some research codes (I also use Julia and C++). The main advantage of Fortran, to me, is that it is very easy to write very fast code, and has very few foot-guns. The latter property also means it can be quite difficult to do non-numerical stuff, but that's a great trade-off if you're a physicist or engineer wanting to write simulations. The name comes from "Formula Translation" for a reason. Doing the kinds of multi-dimensional array manipulation and linear algebra you can do with out-of-the-box Fortran in C or C++ feels like torture.
I generally prefer Julia, as its a more general-purpose language, but there are parts of Fortran I like better than Julia, such as
- Fortran uses static typing and is statically-compiled
- It's a lot easier to write slow Julia code than I'd like, and you generally need to think more to make code fast than you do in Fortran.
However, I think Julia beats Fortran in most everything else. My main gripe with Fortran these days is 1) lack of a decent default package manager (FPM seems great, but most Fortran codes don't use it) and 2) slow evolution due to the conservative standards committee. I don't understand why we still can't have extremely basic generics in 2023, or a simple string type.
- deleted 3y ago[deleted]
- sheepshear 3y agoI've used Fortran for commercial engineering codes. Numerical computing is moving towards layered intermediate representations (IR) in the compiler and runtime to better specialize on the inputs and target hardware. The compiler passes are becoming the focal point and the languages are becoming clients. Fortran's future is probably as a domain-specific language alongside other languages (eg Julia) targeting a common IR (eg MLIR). I don't think we'll see any big changes in the language until it's adapted to fit into the emerging ecosystem.