227 points · by mapmeld · 10y ago · 88 comments
Especially because of the effort it would take to get this working on a "dead" language. Like who are you? How did you decide to work on this for the pure joy of it? Why not Cobol? Why a web framework?
One day I wondered if there was a Fortran server, did some Googling, and found a tutorial from 8-10 years ago (http://flibs.sourceforge.net/fortran-fastcgi-nginx.html). I started out updating the tutorial, requesting some missing files and missing instructions from the authors (almost every Fortran info on the web assumes that you already know how to compile and run your program). Once I was halfway down the rabbit hole, updating this tutorial, it felt right to keep it going
Yours is a nice improvement. If you want to add to the prank, then maybe do a modern-style app or clone of popular one that would definitely delight people. Relatively small app to not take too much time. Offer them a link to the source in case they want to check it out. Let them find out it's Fortran on thdir own. Observe the reactions while recording the best ones. ;)
$ telnet em.prirun.com 8001
Trying 74.131.82.133...
Connected to em.prirun.com.
Escape character is '^]'.
Welcome to the Prime Computer 50-series emulator, running Primos rev 19.2!
Login as user guest, password pr1me
After logging in, use the Prime HELP command for assistance.
You are welcome to create a directory under GUEST for your files.
The line erase character is ?
There are other Primos revs running on ports 8001-8007
Prime manuals at: http://yagi.h-net.msu.edu/prime_manuals/prirun_scans
To report bugs or contact the author, send email to prirun@gmail.com
Enjoy your time travels! -Jim Wilcoxson aka JIMMY
Login please.
login guest
Password?
GUEST (user 2) logged in Wednesday, 22 Jun 16 16:39:52.
Welcome to PRIMOS version 19.2.
Last login Sunday, 12 Jun 16 16:37:20.
OK,1. https://en.wikipedia.org/wiki/Nastran#Software_architecture 2. http://www.zonatech.com/ZAERO.htm
And, inertia isn't the only reason for Fortran remaining popular. Put simply: if you tell a mech.eng./physicist/whatever to write code in Fortran, whatever is produced will likely be fast and relatively readable. Do the same with C/C++, and it will be significantly slower and a horrible mess. Templates-all-the-way-down type of stuff.
Sure, a software engineer could write a C/C++ version that was elegant and as fast/faster than the Fortran code. But scientists don't have the money to hire software engineers. You're lucky if these projects are even under version control.
In practice, what you do is look at the assembly of your inner loops, scratch your head, and try putting "restrict" in various places that seem like they'd make sense, and then look at the assembly of your inner loop. Which requires building a mental model of what the assembly of your inner loops ought to look like, and then actually looking at it, and then running it to see if your idea of what the assembly out to look like was actually a good one.
If your expertise is in numerical methods first and assembly-level optimization second (or, like, nth), Fortran can save you a lot of ballache.
[1] https://www.scipy.org/scipylib/faq.html#how-can-scipy-be-fas...
Numpy will compile f2py (to allow running fortran code in python) and I think it uses the Fortran lapack bindings in some cases if a Fortran compiler is present. However, both of those are optional. Numpy deliberately avoids requiring Fortran in any way.
Scipy, however, uses quite a bit of Fortran in addition to C and requires a Fortran compiler to build.
At any rate, as you noted, it's hardly dead. Modern Fortran is a domain-specific language, for the most part, but it's quite popular within that domain (scientific computing and HPC).
So yeah Fortran is not dead by any means. Tons of people are using it every day, but perhaps not writing code in it. Just like your OS and browser are written in C/C++ but your applications might not be.
In the world of traditional engineering, you will still encounter senior PE's that pump out Fortran. Luckily, it usually isn't fixed form.
Also revisiting older projects can also mean visiting Fortran, and sometimes that can be fixed form (looking at you, wind hazard modelling of tornadic winds for nuclear powerplants).
That's basically it. Scientific programmers are from a different era and a different culture.
When discussing pull requests and changes, having less ego involved makes a big difference.
I wrote the 'fortran+fastcgi+nginx' thingy. It has evolved into https://github.com/rlcarino/heeds. Production live runs (and a little blog post about it) may be found at http://heeds.csu.edu.ph. Some students from a university connect to the runs with their Android phones without cell data cost via Facebook's Free Basics which is available in that part of the world. Usage instructions for students are in the FAQ of https://www.facebook.com/groups/csuheeds/.
Why do it? Somebody pays for it.
Ric Carino
My freshman year I asked my professor why we had to do this one program in Fortran, and after that response, I will never refer to Fortran as "dead" without quotes.
HEAD DIVISION
META-TAGS SECTION.
BODY DIVISION.It is proprietary, but very fast and the backend code is much simplified over COBOL.
Writing to a log file looks like:
fd ?logthis-txt reclen 80
def logthis-usr gp 80
logthis-date an 10
logthis-time an 8
open extend logthis using '/var/log/logfile.txt'
on error next sentence
else display date lj upon logthis-date
call GETIME using logthis-time
move usrid to logthis-usr
write logthis
close logthis.
You can see that a lot of the (unnecessary) typing done in COBOL has been removed.
It has its limitations as most web-frameworks do, but if you have mainframe COBOL and want to present it in the browser with fancy colors and graphics it has more pros than cons.I wrote the 'fortran+fastcgi+nginx' thingy. It has evolved into https://github.com/rlcarino/heeds. Production live runs (and a little blog post about it) may be found at http://heeds.csu.edu.ph. Some students from a university connect to the runs with their Android phones without cell data cost via Facebook's Free Basics which is available in that part of the world. Usage instructions for students are in the FAQ of https://www.facebook.com/groups/csuheeds/.
Why do it? It is a consulting gig.
Ric Carino
http://www.ibiblio.org/pub/languages/fortran/ch1-2.html
Some comparisons are dated. However, I think the older variants still have advantages in readability, more clear semantics, semantics closer to algorithm itself (esp mathematical functions), less guessing by compiler for optimizations, and maybe a few others. Those I listed seem to still be advantages over C in general or as it's commonly used.
Fortran is a really good language for number crunching. Academics who don't know how to code can build very fast number crunching tools without really any CS or hardware knowledge. This the target use case and target audience.
If you want to do low level system things with it, it'll be painful.
[1] Some fortran70 compilers had limited support for recursion it wasn't added to the official language standard until 20 years later tho.