Going through the llvm repository, I found ongoing work on "Flang".
Since "Clang" refers to llvm's C/C++ frontend, I understood that it was probably a frontend of some language that
started with F, but I did not expect it to be Fortran.
Why? - Maybe because of my underlying assumptions about it being an ancient language that I remember being used as an example for an early HLL back in my school. So if its not dead, and people are putting work into it, what does it have to offer?
Aggregating online sentiments (which there are far too many of) - it seems that Fortran is easier to aggressively optimize, or, write code in, in a way that is more compiler friendly. It is also more intuitive and feature-rich for numericals.
Being suited for numerical programming, it has a neat array model which users directly manipulate. This facilitates straightforward vectorization.
There also exists native parallel support (do parallel
) and distributed support in the language for numerical ops.
Def: Pointer aliasing - It refers to the fact that 2 pointers in a language like C/C++ can point to the same memory location, which kills a lot of optimization opportunities - for example constant propagation and code reordering can create unintended changes to the underlying memory.
Fortran has strict aliasing rules, which assume by default that no two areas pointed to are overlapping. C99 however already has
a similar functioning restrict
keyword in place, and major C++ compilers offer similar attributes (though not part of the standard).
Having it as a default enables its usage better I suppose.
This is probably the main reason. The huge pile of abstractions makes debugging and reasoning about computations far easier, along with adding portability. Pair that with its performance and interoperability with C/C++ and you have a language that can be used to extend functionality of existing systems without sacrificing performance or having hardware savvy people care about math (or having math people care about hardware).
Seems like a good language to dive into over a weekend.