3 ms·
As someone who has to use Fortran for their job fairly frequently, I say Fortran is a pretty awful experience compared to Python. Although Fortran is good at a
by xioxox 3y ago
As someone who has to use Fortran for their job fairly frequently, I say Fortran is a pretty awful experience compared to Python.
Although Fortran is good at arrays, it is terrible at any other kind of data structure. You don't get a standard set of useful data structures (e.g. associative map, k-D tree). Unless you like implementing such stuff, you have to look through a bunch of possibly-working half-implemented codes found using google.
For something focused on numerics, it's lacking in standard IEEE numerical things such as a function to check for nan (GNU extension?!). There aren't an easy ways to do SIMD, excepting hoping the compiler does it for you. There aren't even standard numerical constants, so you get the joy of defining your own PI and hoping it doesn't clash with someone else's.
Strings in Fortran are beyond awful, even with the new ability to reallocate string length.
Then we come to the compilers. The commercial ones may be ok. I know the free ones are very buggy.
- Koshkin 3y ago> You don't get a standard set of useful data structures (e.g. associative map, k-D tree) Well, C does not have those, either... (I would not call using C "pretty awful experience" though.)
- d3w4s9 3y agoSo it does not provide good development experience as with Python, as said in that comment. Seems consistent to me? Nobody's comparing Fortran with C here.
- jabl 3y ago> For something focused on numerics, it's lacking in standard IEEE numerical things such as a function to check for nan (GNU extension?!) The IEEE_ARITHMETIC module has been part of the Fortran standard since Fortran 2003, and includes, among others, the IEEE_IS_NAN() function. (Supported in GFortran since version 5: https://gcc.gnu.org/gcc-5/changes.html https://gcc.gnu.org/gcc-5/changes.html)
- ivanpribec 3y agoThe "!omp simd" works very well IMO. In general however, the auto-vectorizer tends to do a pretty good job.
- TheRealKing 3y agoAs someone who has been using about a dozen programming languages over more than two decades, I completely disagree with your experience, some of which appear to be due to incomplete knowledge of the Fortran programming language, including your statement "lacking in standard IEEE numerical things such as a function to check for nan". Everyone talks about C and C++, but we all know in our hearts how terrible the syntax of these languages is.