7 ms·
The perils of polishing old Fortran libraries
- pif 4y agoSo, you stumble on some high-quality code, very-high-quality code, that has worked flawlessly for decades (and if you don't perceive it as flawless, then convince yourself it's your fault), and you dare mature an idea about modifying it? Mayhem be on you!
- dekhn 4y agoI worked on a code (DOCK for docking drugs into molecules) that had a core routine (a preprocessing step) written in ancient FORTRAN by a genius professor. He couldn't explain why it worked, even though he had written the paper and the code. Everybody who looked at it gave up. Eventually somebody invented an all new algorithm for the preprocessing and wrote it in C++ (comprehensibly) and the old routine was retired, to everybody's satisfaction.
- tpoacher 4y ago> Familiarity breeds respect Nice.
- lmm 4y agoI mean the lesson I'd take from that is "don't use a buggy compiler". If you can't trust your tools then it's very hard to make something you can trust with them. That changing the code means it compiled in an incorrect way that your test case happened to hit doesn't mean the previous version of the code was being compiled correctly, or was correct code.
- jrochkind1 4y agoI mean, I guess "don't produce or use buggy software" is good advice, depending on what function you're looking advice to do.
- rob74 4y agoThe lesson I take from this is to steer well clear of historic languages with the many intricacies and interdependencies described in the blog post. I assume that there is a reason why that old buggy compiler version is still in use - probably some legacy library or code that only works with that version of the compiler and that nobody has touched for 20-30 years and nobody wants to touch?
- shusaku 4y agoI’m defense of FPS 4.0, plenty of modern Fortran compilers have bugs too…
- Jeff_Brown 4y agoThe best defense being a good offense.
- Koshkin 4y agoFortran 66 was the pinnacle as a no-nonsense practical programming language. No semicolon cancer, no fancy brackets, just code that looks like code. Beautiful (in a nerdy kind of way, by today’s standards).
- AdieuToLogic 4y ago> Fortran 66 was the pinnacle as a no-nonsense practical programming language. You got me by a major release. My introduction to Fortran was Fortran 77 on an antiquated IBM mainframe (event at that time). Loved it, even if I could never remember what column I needed to use :-).
- msla 4y agoA Real Programmer can write FORTRAN IV code in any language.
- ratboy666 4y agoThe pinnacle... huh. What about assigned goto? hollerith?equivalence? Please look at the following: C THE CALLEE SUBROUTINE X(I) GO TO I END C THE CALLER ASSIGN 10 TO J CALL X(J) C THIS IS NEVER REACHED STOP 10 WRITE(3,100) 100 FORMAT(8H THIS IS) END Why would this work? Because recursive calls are not allowed, There should NOT be a stack. So allow rather arbitrary jumped around (setjmp/longjmp) is um... ok?!? And what happens if a normal integer is passed to that code? (and it is separately compiled). Yikes.
- Koshkin 4y agoOr, with proper formatting: C THE CALLEE SUBROUTINE X(I) GO TO I END C THE CALLER ASSIGN 10 TO J CALL X(J) C THIS IS NEVER REACHED STOP 10 WRITE(3,100) 100 FORMAT(8H THIS IS) END
- readthenotes1 4y agoNothing like characterization tests to help with work like this...
- zippyman55 4y agoMy favorite personal Fortran story: I was passing by a WAY SMARTER THAN I COULD EVER HOPE FOR guy who was pouring over a two inch Print-out of some scientific code. He had been trying to troubleshoot a problem. I guess a comma was in the 80th column, which I recall presents an error. In my passing by, I pointed out the error (one second) and I always had his respect after that.
- JoeAltmaier 4y agoI've had less success pointing out errors to people 'smarter' than me. One was stuck learning C because they knew just enough about scope to be dangerous. They'd declared 'i' globally and used it in every subroutine for looping. Which failed confusingly when they called one looping function inside a loop in another. No amount of insisting each function needed it's own 'i' would convince them. I left them to it.
- AnimalMuppet 4y agoIn college, I was writing something in Fortran, and I made a typo. I was trying to call the cosine routine, COS, and I overshot the "oh" key, and typed C0S. It took me two days to figure out why Fortran didn't know what cosine was.
- Koshkin 4y agoI don’t know how one cannot see the difference between the letter O and the digit 0
- AnimalMuppet 4y agoFirst, it was supposed to be a capital letter O, because Fortran. Second, this was about 1982, on a green-screen terminal with not a lot of resolution. And third, I was a naive 20-year-old without a lot of experience at what fat-fingering things can do, so I wasn't really looking for that.
- Koshkin 4y ago