Skip to content

Comment on Toward Modern Fortran Tooling and a Thriving Developer Community

Comments

Scientific computing has the reputation, perhaps unfair, of being write-only programming. True?

In the 60+ years since Fortran was invented, enormous strides in computer languages have made source code more readable, and 99.9% of new programmers learn on only those languages.

If you ignore all that and continue to write Fortran, you've guaranteed that almost no one except other scientists will ever want to look at your code. And probably not even them.

I think there's a common misconception that numerical codes should be accessible without documentation, and without a background in the subject.

https://github.com/nasa/NASTRAN-95

Take NASTRAN-95, for example. It has good documentation in the form of manuals, books, and papers. If you have the mechanical background, you should be able to understand the docs explaining the implementation approach, and then you should be able to understand the code. It doesn't matter that there are no comments anywhere. Aside from some cosmetic differences, it looks pretty much like what you'd write today with MATLAB. It's perfectly readable and accessible by the target audience.

I don't think anyone would say that all code should be accessible to everyone.

The question is, do people who use [1] and [2] use only FORTRAN for everything, even common programming tasks that any competent person could tackle? And when they have something new to write, do they continue with FORTRAN because it's what they're used to?

I just meant to say that numerical code is not actually write-only.

Fortran is like a DSL. You just write the numerical solver part with it. Everything else is just regular code.

Just like anything else, the decision comes down to whether the ecosystem has the right tools for the job. It's a deliberate decision. It's not like people are relegated to it because they don't know anything else.

“True?”

No. I’ve never heard this before. It’s true that scientists don’t always write the clearest code, but Fortran, and even the style of Fortran typically written by engineers and physicists, is comparatively straightforward to read. It is named for FORmula TRANsator, after all. You will recognize the equations in the code. Fortran is inherently easier to read than C; it’s really not harder to read than Python. You can make it hard to read by doing complicated array indexing tricks, of course, and there are sometimes good reasons to resort to that.

And no one except other domain experts will ever have any interest in looking at your source. Why would they? No one except someone designing a website will ever want to try to figure out your CSS either.

All code gets looked at by someone else, sooner or later. And the equations are never the hard part -- it's the control flow.

Ok, now I see where the confusion is coming from. Fortran is used pretty much exclusively for numerical software. A lot of numerical software has very simple control flow using very few and very simple types. Numbers haven't changed much since they were invented. Fortran is used very differently than you're imagining.

...by people who have a reason to look at it.

What is it about Fortran’s control flow that makes you think it’s particularly hard to read? Say, harder than Python? Note that people don’t generally use computed GOTOs any more.

Your concept of Fortran sounds a little out of date to me; have you taken a look at it in the past 31 years?

Deplorably, no. Haven't looked at Object-Oriented COBOL, either.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.