Hacker News new | ask | show | jobs
by hilbert42 1919 days ago
1. There are thousands of scientific subroutines written in Fortran that are stable and well tested - in fact, there are well established formal libraries of them that go back over 60 years. The researchers know and trust them.

2. Despite the sneers and derision that Fortran has been subjected to from non-Fortran programmers over recent decades, Fortran is an excellent language to do intensive scientific and mathematics work. Compilers are optimized for calculation/math speed and large intensive calculations. From the outset, it could handle complex numbers, double precision, etc., etc. natively without having to resort to calling libraries/special routines as other languages had to do back then.

3. Scientific enterprise alongside mainframes and supercomputers have well established and stable ways of working including program and data exchange etc. Essentially, a well established computing ecosystem/infrastructure surrounds scientific computing that researchers know and understand well. There is no need to change it as it works well. Moreover, it's a stable and reliable environment when compared to other computing environments - Fortran was introduced long before the cowboys entered the computing field, back then the programming/computing environment was more formal and structured, this contributed to that stability.

For the record, Fortran was the first language I learned, and my programming back then was done on an IBM-360 using KP-26 and KP-29 keypunches and 80-column Hollerith cards.

6 comments

Researcher in Nuclear Engineering chiming in with a similar experience. Much of our code is the same way, and in fact our field more or less invented many computing methods used today. One widely used simulation code called MCNP [1] can trace it's origins back to running on the ENIAC at Los Alamos in the 40s(!). At some point, it was considered a major upgrade when it was rewritten into fortran90.

[1] https://en.wikipedia.org/wiki/Monte_Carlo_N-Particle_Transpo...

> From the outset, it could handle complex numbers, double precision, etc., etc. natively without having to resort to calling libraries/special routines as other languages had to do back then.

At least until sometime in the '80s another advantage of Fortran over C was that it could handle single precision floating point. C always promoted float to double when you did arithmetic with it.

Arithmetic was faster on floats than doubles, and that could make quite a difference in a big simulation that was going to take a long time to run.

The high energy physics group at Caltech back then had a locally modified version of the C compiler that would use single precision when the code tries to do arithmetic on floats. Some of the physicists used that for programs that otherwise would have been in Fortran.

That makes it pretty clear that Fortran is set up to be the perfect foe to "latest has to be greatest" programmers.
It took until C99 for C to have complex numbers and `restrict`. Those are two features FORTRAN has had for a much longer time, right?
You're testing my memory now. If I recall correctly, at least complex numbers were in the WATFOR (University of Waterloo) FORTRAN-IV compiler that I used in 1968 on the System/360. (That said, I've always understood it was there from at least FORTRAN II.)

I seem to recall needing 'i' for vector stuff, Maxwell's equations etc. (If I'm wrong it must have been on the VAX FORTRAN-IV several years later.

Correct me if I'm wrong.

And like in everything C, unlike Fortran, there is no way for the compiler to validate if restrict is being used properly.

Use it wrong, break the compiler assumptions and the bug hunting fun starts.

Mostly the compiler won't catch violation of the storage association rules. Toolpack had a useful tool for strict F77 code which was a boon fixing stuff not to break with the Alliant compiler, which was the first one the project I inherited used that took advantage of the optimization opportunity. Possibly Cray's would have done, but hadn't been used for a while at that point.

The fact that people won't believe the rules exist, is a continual source of bug hunting in Fortran unfortunately. At least restrict is visible.

How does Fortran enforce this, actually? Does it just not let you pass the same array to a function via multiple parameters?
Fortran didn't originally have pointers, and pointer based code is relatively rare in fortran, so making requirements about pointer aliasing doesn't have same potential to completely break your code that it does in c. The reason c can't actually restrict the restrict keywoard, is that the standard would break code!
The storage association rules have nothing to do with pointers like that. Code will typically break because arguments are passed with copy-in/copy-out semantics, not by reference.
It does, indeed, but that's not the only way to associate storage. Using INTENT to specify whether an array is updated is useful.
I __think__ Fortran just never gave you this particular footgun. No aliasing of pointers allowed from the getgo. It was never an issue. Somebody let me know if that is wrong.

I read Complex numbers came in FORTRAN IV, so mid 60’s.

I never used anything older than FORTRAN 77, and it certainly had complex numbers, and also ways for the “inventive” programmer to make use of pointer like functionality. You could e.g. pass functions to functions, if you were so inclined.

"I read Complex numbers came in FORTRAN IV, so mid 60’s."

FYI, this link [PDF] https://personalpages.manchester.ac.uk/staff/paul.johnson-2/... contains the peculiar statement "Over the next few years, FORTRAN II would also add support for the DOUBLE PRECISION and COMPLEX data types."

At face value, that statement implies complex numbers came later but before FORTRAN III, which also implies a point release (FORTRAN II was released in 1958). Moreover, I read somewhere that FORTRAN III had it but it wasn't widely released. Likely then that FORTRAN IV was the first widely released version with complex numbers. As it was released in 1961, we should assume then that this was the likely date.

Pretty cool, thanks for the details! This is about what I’d expect from ancient FORTRAN. (I read fortran IV off Wikipedia, maybe there was fine print)
You'll note from one of my other posts that FORTRAN-IV was my intro into programming. However, that was toward the end of the decade not the beginning. By then, many universities were running the WATFOR FORTRAN-IV compiler from U. Waterloo.

At the time it was anything but ancient. We students felt both cocky and privileged in that we knew that we were some of the very few people in the country who had access to a state-of-the-art IBM mainframe.

BTW, the mainframe, a System/360, had just 44kB memory and ran 7 concurrent operations at once. It was a red-letter day when the '360 got upgraded to 77kB memory. The university's rag had the fact as large headlines on its front page.

I like it! Sorry to call older dialects ancient. Being a Fortran programmer is somewhat like being from a red state, I find. I naturally self deprecate (or stick with c++ as appropriate) in front of others.

I used to work on a system that was older than me, but immaculately refactored (to the authors admittedly rare taste) through the years. It had run on all kinds of hardware in the 80s, but was different enough from its predecessor programs that I am not sure what all it ran on - I recall maybe DEC, maybe pdp this and that, maybe a 360?? being mentioned. The guy who led the team that wrote it passed on two years ago now. Man he was a trip! He wasn’t old. He used to smoke, darn it.

Sounds like you had some fun times with the 360! Makes me want to retro-compute a bit. Actually my phone makes me want to retro compute as well, every time I “type” on it. ;)

Cheers!

Ahem ;-)

Somehow your mention of cowboys entering the field feels irritating, considering Kazushige Goto and his contributions to BLAS while being in Austin, TX.

Banzai!

While Goto typically gets the plaudits (and obviously did good work there), you should credit van de Geijn in that area long term.
Oops.

Haven't even been aware of that.

Anyways, irritation over 'cowboys entering into the field' still stands, because it happened in Austin, TX.

Yeehaw!

;-)

Tested in the sense of test suites and formal proofs? That would be valuable to other disciplines using other tools.

But this article isn't about fundamental algorithms being correctly-implemented in an endowment of legacy code, it's about defending a siloed language choice, which seems like an antiquated concern to me.

I applaud anyone using a tool that works for them, but if it's good, then its users have accomplished things which transcend an individual tool.

"But this article isn't about fundamental algorithms being correctly-implemented in an endowment of legacy code, it's about defending a siloed language choice, which seems like an antiquated concern to me."

1. The first comment I would make is that the headline premise is wrong or at least deliberately misleading. Let's start with a correction. I would very much doubt that climate models are written in programming languages from 1950s. The Fortran code of the 1950s was not that much like the Fortran code that I learned in the late 1960s, and that late 1960s code bears little resemblance with modern Fortran code of today. Furthermore, the Fortran standard is certainly not dead, it is being continually updated: http://fortranwiki.org/fortran/show/Standards.

2. When I made comment about libraries going back 60 or so years, this would imply that libraries written in Fortran II ca 1956 or so would pose a problem today. I would suggest that it is not so because the process of updating libraries is formal and strict, thus an updated Fortran II subroutine would work perfectly well with today's modern Fortran. This 'upgrade' process is not like converting code from say Pascal to C or whatever, for here we are still within the confines of the Fortran framework and that that conversion process is well understood, straightforward and procedural.

3. This isn’t my idea, nor am I defending something that I learned decades ago and don't want to give up. Frankly, I do little Fortran programming these days so it's essentially irrelevant to me. The point I made and that I make again is that there is a sophisticated scientific computing environment in existence and it is used by thousands of current researchers and scientists around the world. Scientists would not use antiquated software on cutting edge science if it did not work. The fact is modern Fortran is a modern programming language that delivers the goods par excellence—likely much better than any other language, especially so given its long and mature infrastructure. For example, here are the first two reference I came across on the net, there are thousands more just like this:

https://arxiv.org/abs/hep-ph/0612134

https://www.sciencedirect.com/science/article/abs/pii/S00104...

4. Now let's look at the current situation—'modern' software. To begin, you should read this 27-year old Scientific American article titled 'Software's Chronic Crisis' from September 1994:

https://www.researchgate.net/publication/247573088_Software'...

I would contend that this article is just as relevant today as it was 27 years ago if not more so. In summary it says.

• Programmers work more like undisciplined artists than processional engineers (this problem remains unresolved).

• Essentially programming is not true engineering (since the time of the article, computer science has progressed somewhat but on the ground we still have multitude of unresolved problems).

• If programming is to be likened to engineering then it is in a highly unevolved state somewhat akin to the chemical industry ca 1800. Its practical function or operation is a mismatch with the everyday world or we wouldn't have the proliferation of problems that we currently have.

When, these days, one examines the situation with literally hundreds of different computer languages in existence, it is clear that there isn't enough human time and effort to rationalise them all and develop a coherent set of tools, in essence almost everything around us is only half done. We stand in the midst of an unholy Tower of Babel and it's an unmitigated mess (I could spend hours telling you what's wrong but you'll know that already).

The crux of the problem is that programmers spend much time and resources learning one or more computer languages and that it's dead easy to poke fun at mature languages such as Fortran as being old fashioned and out of date. The fact is they either do not adequately understand them or the reasons why they are used, or it is both.

The fact is it is this very maturity of Fortran that makes it so valuable to scientist and engineers. Those who are not conversant with or do not program in Fortran have simply not understood the reasons for its success.

Scientists and engineers have found the most reliable, stable and best fit available and that is to use a modern version of Fortran—simply because its reliable and it works.

This article only shows authors lack of understanding of the problem.

Oh, BTW, let me add that I have no contention with theoretical computer science models. It's just the divide between theoretical computer science and what happens in practice is as wide as it ever was.

I guess the downvotes and this reply indicate I was unclear or wrong, but I can't tell how. I guess suggesting that the rest of us can learn from Fortran is disrespectful to it, which means I'm not interested.
"I guess the downvotes and this reply indicate I was unclear or wrong, but I can't tell how. I guess suggesting that the rest of us can learn from Fortran is disrespectful to it, which means I'm not interested."

Please don't get upset about this, you're not alone. I try to state my opinions forthrightly to stimulate debate and sometimes that sounds abrasive, especially so when there's a clash of cultures (which is partly so here). Incidentally, I didn't downvote your comment.

It is hard to summarize or adequately paraphrase all the technical and cultural issues involved with programming here because there are so many, to do so would require a book of explanations. Moreover, an adequate and satisfactory explanation of the problematic issues facing modern computing would have to begin with a high-level overview then it would be necessary to drill down and explain the many underpinning parts one by one. For instance, to provide a proper explanation of why programmers tackle or approach their work in a significantly different way than is done in traditional (well proven) engineering and why this has had a noticeable deleterious effect on programming rigor one would also have to launch into a study of modern-day ergonomics of programming—and this, in and of itself, would be a massive undertaking.

Treating the matter bluntly, which I admit I've done here in my summary of the September 1994 Scientific American article [Software's Chronic Crisis], will definitely alienate many present-day programmers but what else can one do to raise attention about such an important matter in such a short space? How do we raise and restate the fact that not only SciAm's staff writer, W. Wayt Gibbs but also that many others have put forward strong evidence to the effect that the way we tackle practical programming tasks isn't truly professional and that it is this lack of professionalism that is a major contributor to modern-day computing problems—and do so without actually offending anyone? I reckon one cannot, and the fact that even raising the issue (as here) alienates is also problematic (in that it acts as an additional contributory factor that must be managed).

For reasons already mentioned, Fortran has effectively managed to bypass many of these problem because of its historical role and the fact that it successfully services a specific niche field, albeit a very large one.

Many programmers of other languages do not appreciate the fact that one of the main reasons why Fortran still has such a strong hold upon scientific and engineering programming is because of its origins. Fortran's very raison d'être arose directly from a very practical need of electrical engineers to overcome the problem of the assembly language bottleneck, its limitations were that it was not only slow and tedious but also error-prone, especially so when the job was a big one.

It is high tribute indeed that John Backus and his team did such a remarkable job in solving the input bottleneck problem with Fortran; the fact that they did so in such an effective and eloquent way is the reason why Fortran is still alive and well today some 65 years after its initial release. (It's worth taking a minute to read this Wiki on Backus: https://en.wikipedia.org/wiki/John_Backus.)

Thus, from the outset, Fortran was seen as a very useful tool, for the first time scientists and engineers now had a practical and comprehensible way of entering science and engineering data into computers in ways that were essentially analogous with those that they had always used to solve practical problems that required mathematical solutions.

The key point was (and still is) that Fortran programs now allowed for computer input that was easy to understand as it offers a representational view of what was already within the mindset of programmers whose principle interests were in science and engineering and NOT specifically programming per se. That is, Fortran was and is still so successful in those fields because its paradigm or modus operandi allows it to align easily with or follow accepted methodologies and practices—and that this usefulness was immediately obvious to its target audience/users.

Programmers of other languages must get their heads around the key fact that Fortran, scientists and engineers were a dovetail fit from the outset (and they still are). Therefore continue to expect to see climate models and most other [especially large] scientific modelling to be written in Fortran for the foreseeable future!

Nowhere in these posts have I said that Fortran is the best programming language or that it ought to be a kind of universal language—nothing is further from the truth. Essentially, I am just making the point that currently it is the best fit for the job and that it has long demonstrated the fact with its well established lineage of some 65 years.

Initially, I too was underwhelmed by Fortran. When I was first confronted with having to study it I thought that whoever dreamt up this goddamn cryptic system could have made it much more logical and intuitive (back then, there was little to compare it with—not even BASIC) not to mention its seemingly arcane basic input and output statements (format, print and all that horrible Hollerith stuff). To my mind, they were so overly complex as to be essentially impractical (and my errors were numerous).

Of course, the real problem turned out to be me—not the language! Like many programmers who have objected to having to change programming languages and or having to dispense with bad habits in exchange for better ones, initially I too riled against certain programming improvements made in later versions of Fortran, so I well understand where the reluctance to accept Fortran comes from. (This I believe is the crux of the problem. As we can see from the story/article, the author, Partee, has aptly demonstrated his ignorance in such matters, unfortunately he is not alone.)

For instance, early versions of Fortran made much use of the GO TO statement. I loved it, as there was seemingly no end to the amount of spaghetti code that I could write without doing hardly any planning. Moreover, in the days of punched cards, GO TO statements also made programs easy to modify on-the-fly (as most of us had many pre-punched cards that we could insert into a card stack for a quick fix). When GO TO was rightfully depreciated to force a more structured programming style I, like many, initially resented the fact. [FYI: http://fortranwiki.org/fortran/show/Modernizing%2BOld%2BFort...]

I believe that much of the reason for why Fortran is not appreciated for what it is and why it has little currency outside the scientific and engineering communities is this commonplace reluctance of many to take time to appreciate facts or things that are seemingly outside their realm of interest or their immediate need to know. Right, it takes both time and effort to appreciate what Fortran is about and few are actually prepared to invest in either let alone both. Dismissing Fortran as obsolete and irrelevant is thus a much easier option.

Remind me not to compliment Fortran in the future, HN hates it.