7 ms·
I had to touch a little bit of Fortran 77 when I interned at Lockheed Martin nine years ago. While I don't know that I would use Fortran for anything nowadays,
by tombert 7y ago
I had to touch a little bit of Fortran 77 when I interned at Lockheed Martin nine years ago.
While I don't know that I would use Fortran for anything nowadays, I do kind of have to appreciate how completely simple Fortran was in comparison to my favorite language of the time, C++ (I hadn't learned Haskell or Lisp very well at the time so I didn't know better :) ).
I haven't touched any later standards after 77; is Fortran still technically not Turing complete?
- mhasbini 7y agoOut of topic. I recently finished reading "Skunk Works Memoir" and I'm interested in the day-to-day life for a developer there. Would you mind sharing a bit of your experience?
- tombert 7y agoI was only an intern, and I haven't read that book, but it was overall a fun job. I was of a bleeding-heart-pacifist, so I made it pretty clear that I didn't want to work directly on weapons or anything like that and as a result, around 90% of what I worked on was actually C++ working on a camera to help detect mines. The Fortran I touched was actually in an unrelated department; to what I was doing. Basically there was some old code that needed to be ported to an newer system; it was largely following the Fortran 77 spec so all they needed was an intern to copy the code over to a newer machine, and fix the compiler bugs.
- ajxs 7y agoI find it hard to justify why, but I'm always so curious about those legacy systems still running in enterprise-scale companies. I doubt that working on them is anything short of terrifying, but I find it so interesting to hear about what important systems are still out there running just fine on ancient tech.
- grumpy8 7y agoI mean, when you have millions of line of code, it takes many many years to rebuild the system. It may make more sense to abstract away a part of the code and treat it as legacy-API-that-works-fine, and write new code in a new language.
- shakna 7y agoLinking COBOL and Fortran against C is actually one of the easier things to do. So with these multi-million line systems, often new features are written in C++, minor minor minor bugfixes in the original language, and general maintenance is a toss-up if it's a re-write in C++ or just fix it in the old language. Depends on how fast they need it. I did some Pre66 Fortran work for a bank, and that was basically the idea. They were in the process of converting internal assumptions of the program from a very particular older mainframe type to a mix of Z/OS and Solaris, and the Fortran/COBOL into something they could continue working with. Some of the code was very specifically marked as "not for C++", because modern Fortran (2003 at the time) was better for some specific number-based things. But that code becomes a library rather than part of the original monolithic structure. And modern Fortran is actually quite a nice low-level language to play with. It was actually easier than expected - when the original program was written, and for about the next twenty years following, the entire program and changes were very well specified in multi-thousand page specifications. The newer code was harder to keep track of, rather than the oldest, because at the oldest those documents were 99% accurate, even if you never trusted them to be because of the intervening time.
- lallysingh 7y ago> Some of the code was very specifically marked as "not for C++", because modern Fortran (2003 at the time) was better for some specific number-based things. Was that a you-can't-do-that-in-c++ thing or slightly-faster-in-fortan thing? I'm always skeptical about the latter guiding major maintainability decisions on often-specious performance benefit claims.
- sampo 7y agoIn the areas where you'd want to use modern Fortran (numerics, not TCP servers), it is easily also more maintainable than C++.
- shakna 7y agoSlightly-faster-in-Fortran. But it wasn't just a slight gain. The system I'm referring to is a multi-national system that processes somewhere in the order of 50-100 million transactions a second (depending on the time of day, and the day itself). A slight performance gain of 1% by using Fortran has a noticeable effect on long-term economic gains. (It was usually in the range of 5-8% performance improvement, but at the worst was 1%). Thankfully, the reason I can tell you this, is because they tested it in the real world, splitting all transaction across a large-scale A/B test. The real-world economic gains from the faster performance more than paid for the occasional development costs of a Fortran-familiar developer, hence why those systems persist in Fortran. They also scheduled re-assessment of this once every five years, knowing it might change one day.
- apaprocki 7y agoNot terrifying at all.. for the most part Fortran-used-like-C looks pretty much like... C. Declare a header signature the right way, call any Fortran function from C, declare any C function with an underscore at the end and constrained to some rules and call it from Fortran. Like other comments point out, there’s nothing “ancient” about the language. You don’t need to hunt for dusty floppies and emulators to boot old OS images from tapes. GCC 9.2 compiles it all.
- Annatar 7y agoYep, compiling Fortran right now with GCC 9.2.0. Modern Fortran is wonderful, and CUDA Fortran is a blast.
- fulafel 7y agoC/C++ compilers matching Fortran performance in numerical work is a relatively recent development. F90 and later said to be pretty ok ergonomically.
- pjmlp 7y agoAnd it requires lots of template metaprogramming to actually achieve it, see eigen. Not to mention all the unsafety issues. while fortran is bleeding fast while keeping safety on.
- C1sc0cat 7y agoProbably no more terrifying than a similarly sized system in C C++ or a more modern stack. Back in the day I worked on billing system for BT written in Fortran 77 and Pl/1G and that was ok to pick up - we did have an actual genius as a team leader and designer though YMMV
- milancurcic 7y ago> I haven't touched any later standards after 77; is Fortran still technically not Turing complete? Fortran has been Turing complete since its inception in 1957 :).
- tlb 7y agoThe argument against f77 being Turing-complete is that you can't dynamically allocate memory, or specify infinite arrays, or recurse. You have to declare a finite size for everything. So a program embodies a fixed limit on how big a problem it can handle. In C (the abstract machine with arbitrary-sized ints) you can allocate an arbitrary amount of memory. It may, of course, not run on any given machine. But the language itself allows it.
- jcranmer 7y agoIf that makes F77 not Turing-complete, nor is C. There is a finite amount of memory you can allocate in C, since a pointer must have finite size, implying there is a finite number of things it can point to.
- tlb 7y agoThe C language specification doesn't require a pointer to have finite size. Just because every C implementation has a limit, it doesn't mean the language itself does.
- tzs 7y agoDoesn't it imply that it must be finite, because you can use sizeof() to find its size, which yields something of type size_t, which has maximum size SIZE_MAX?
- trillic 7y agoThe idea is that theoretically a perfectly portable C program could be written and work on problems of any size given sufficiently large hardware and a compiler implementation that takes advantage of that hardware. Unlike a Fortran77 program, a portable C program doesn't have to change to support orders of magnitude changes in problem size.
- pm90 7y agoMany of the libraries used by popular Data Science/Vis tools today (Matlab, Numpy etc) use BLAS and LAPACK which are written in FORTRAN
- lordgrenville 7y agoPlus on the topic of Data Science, R is written in a mixture of FORTRAN and C!
- Annatar 7y agoYes, the core of R is written in Fortran because short of writing assembler code by hand, Fortran compilers generate the fastest machine code.
- Annatar 7y agoYes, for performance. If you need something to be fast and yet portable, Fortran is still the #1 language of choice, especially in supercomputing and finite element analysis fields.
- alexhutcheson 7y agoBLAS now has a number of non-Fortran implementations, inlcuding ATLAS[1] (C) and and Eigen[2] (C++). LAPACK is still Fortran-only, although many libraries (including the two mentioned above) implement a subset of LAPACK in other languages. [1] http://math-atlas.sourceforge.net/ http://math-atlas.sourceforge.net/ [2] https://bitbucket.org/eigen/eigen/src/default/Eigen/src/misc/blas.h https://bitbucket.org/eigen/eigen/src/default/Eigen/src/misc...
- yiyus 7y agoModern Fortran is practically a totally different language (although, maybe surprisingly, still compatible with older standards). In fact, it is a quite comfortable language to use if you need to work with vectors and matrices. In very rough lines: numpy array syntax with better than C performance.