Anecdotal Fortran... :-)

Its logo is used at the top of the LinkedIn Fortran Programmers group!

2 Likes

In the Simpsons episode The Man Who Came to Be Dinner (2015), an alien says (at 1:23):

“As young thinglings, we are schooled in the wisdom of the universe. Physics, mathematics, FORTRAN - the greatest of the programming languages!”

8 Likes

We should prolly make these for the official Fortran logo! I love maker communities like Redbubble and Etsy.

1 Like

Operator precedence by textual substitution: A technique from early Fortran
by Mark J. Nelson
2022-05-15

Fortran (also from IBM, released 1957) gave in and did implement operator precedence. But it did so using a method that seems to me equal parts ugly hack and clever solution, a raw textual search-and-replace scheme. As Knuth summarizes:

An ingenious idea used in the first FORTRAN compiler was to surround binary operators with peculiar-looking parentheses:

+ and - were replaced by )))+((( and )))-(((
* and / were replaced by ))*(( and ))/((
** was replaced by )**(

and then an extra ((( at the left and ))) at the right were tacked on. The resulting formula is properly parenthesized, believe it or not. For example, if we consider “(X + Y) + W/Z,” we obtain

((((X))) + (((Y)))) + (((W))/((Z))).

This is admittedly highly redundant, but extra parentheses need not affect the resulting machine language code. After the above replacements are made, a parenthesis-level method can be applied to the resulting formulas.

2 Likes

Update with a fix : The fix is fortunately straightforward: add even more parentheses!
Right, so 1+1 becomes (((1)))+(((1))). Even Lisp, the notorious parenthesis lover, would need less of them to do the job. I wonder how many punch cards were needed for just one “real world” expression. :laughing:

1 Like

I don’t think it was output on punched cards. The compiler added those parentheses during the compilation process, then evaluated the parentheses, then the resulting object code was output on cards.

In the book Abstracting Away the Machine: The History of the FORTRAN Programming Language (2019) by Mark Jones Lorenzo, see pages 137-138. The method was invented probably in 1955. Nothing existed, they started nearly from zero. Parsing an expression was something new.

Well, IIRC LISP does not have the problem of parsing mathematical expressions: it is up to the programmer to put all parts into the right set of parentheses. They seem to have been tempted in the very beginning to build a parsing algorithm into the language but then decided it was not needed or desirable, once the language caught on.

A. Michael Noll Pioneers Computer Art in the United States

"During the summer of 1962, A. Michael Noll had an assignment working in the research division of Bell Telephone Laboratories, where he was employed as a Member of Technical Staff. His summer project involved the programming of a new method for the determination of the pitch of human speech – the short-term cepstrum. The results of the computer calculations were plotted on the Stromberg Carlson SC-4020 microfilm plotter.

"The SC-4020 plotter had a cathode ray tube that was photographed automatically with a 35-mm camera. The SC-4020 was intended as a high-speed printer in which the electron beam was passed through a character mask and the shaped beam positioned on the screen while the shutter of the camera remained open. The staff of the computer center wrote a FORTRAN software package to interface with the SC-4020 in positioning the electron beam to draw images on the screen, mostly plots of scientific data, with a 1024-by-1024 resolution.

Noll has a site with computer art.

2 Likes

Colossal Cave Adventure has been recently uploaded – it is a single file that compiles with gfortran -std=legacy and ifort. Looking at the code, it could be an interesting modernization project.

5 Likes

I have a colleague who I recently found out was as a grad student at MIT an early playtester of Zork (Colossal Cave Adventure). I still play it occasionally, could never get too far.

1 Like

Just released yesterday: “Fortran in 100 seconds”
Edit: discussion thread here: Fortran in 100 Seconds

1 Like

taxsim.app, an interactive U.S. Individual Income Tax simulator, written in FORTRAN 77 and converted to WASM using emscripten. Quote from the orange site:

1 Like

Yes – the author of TAXSIM, Daniel @feenberg, is a member here and has also participated in comp.lang.fortran. The tax code is pretty messy. To translate it into computer code I think features of modern Fortran such as derived types would be helpful. I wonder if TAXSIM will converted to a later version of Fortran.

1 Like

I would like to take this opportunity to say why I am unlikely to modernize the code. The reasons fall in to 2 categories.

First, by keeping to F77 I maximize the portability of the code. Many of my users are at government agencies that have very strict security requirements. Most won’t accept a binary executable but I can send F77 source and be confident that even if the agency hasn’t paid for a fortran compiler, one is likely to be available. If none is available, perhaps a c compiler is available and I use f2c to create c code. The fact that excellent modern fortran compilers are available for free download is of little use to many of my users, who would need to appeal to a very unsympathetic security committee in their Department of Information Prevention for permission to install one, a committee that probably meets once or twice a quarter and is unlikely to approve something merely for research purposes. I never cease to be amazed by the assumptions of software developers as to the ability of users to affect their environment. Developers in the tech sector often have considerable freedom. Policy analysts in US executive agencies often have none.

Second, modern Fortran does not offer a lot for this sort of calculation. I know of tax calculators written in modern languages such as Python or R and using matrix operators, but that doesn’t make for much more compact or clearer code. Taxsim reads a record, puts it through a series of several thousand assignment statements, of which the majority are behind an “if” guard. In 30,000 lines of code (mostly data statements) there are a handful of loops, a few hundred subroutines and a couple of gotos. Then it writes the result. There isn’t a lot of scope for recursion or objects or even matrix operations to simplify matters. I don’t need to allocate arbitrary sized arrays and everything is double precision.

The aspect of modern fortran I most miss is the ability to have more than 19 continuation line in a data statement. I don’t want to separate the tax law parameters into a separate file, since it would complicate things for users. Even setting an environment parameter to that filename would be a challenge for many of my users.

I used to have a third reason for keeping with f77. When the program was smaller, I could use the Watfor compiler to ensure there were no undefined actions. The runtime debugging features of modern compilers are not nearly as comprehensive. For example, gfortran can catch uninitialized reals now, but not integers. Valgrind is very helpful, if difficult to interpret.

The desire of programmers to use the most modern, rather than the most portable code in their work is generally motivated by the desire for personal and career growth, rather than direct user benefits.

It is possible I am over-influenced by portability considerations, but I recall as a graduate student the most knowledable fortraners in the Princeton University “ready room” were the authors of PStat, and they were proud of the portability they had achieved. Later, in about 1983 I was porting an 80,000 line statistical package written in fortran 77 that had a single line of fortran 90 code. That was the only required change. It struck me as a bad idea to compromise so much for the sake of a single line of code. These formative experiences, together with the pleas of users have been quite influential in my thinking.

7 Likes

Is Fortran still used by finance/economics academics nowadays?

Using standard Fortran results in the most portable code. Of course, compilers need to implement new features which might take a while.

Or they simply use gfortran which is open source or the Intel compiler which is freely available. Both support modern standards.

How many security breaches resulting from the use of modern Fortran compilers have been reported?

That is why there is a tendency for good people to work in the tech sector or in institutes where administration supports the needs of their researchers.

2 Likes

All compilers I’m aware of support the selection of the standard. You want to compile code from the 70s? Fine, use -std=legacy with Gfortran.

Of course there are no actual legitimate security vulnerabilities that
would justify blocking the installation of any of the available fortran
compilers, but that has no effect on the typical security committee. The
existence of execute_command_line() suggests that one might want to be
careful about importing fortran sources or executables, but the reported
CVEs for ancient versions of libgfortran don’t seem actually exploitable.
Let me finish with an anecdote.

Many years ago I had a user at the Federal Reserve Board in Washington who
wanted to ssh to our computer for a project. Fine with us, but it turned
out that ssh was blocked at the Board firewall. An appeal to the Board
data security committee got a response citing a documented vulnerability
in ssh and steering the user to telnet, which was allowed (telnet probably
had a more powerful sponsor)! I would not allow telnet, but found that I
could put sshd on the telnet port, and all was good.

My father used say “The perfect is the enemy of the good.” Common sense
suggests that it would be best for the Board to adopt the correct policy,
but if I held out for that, I would have lost a user for sure. It only
makes sense to hold out for perfection if you have the ability to make it
happen.

Daniel Feenberg

2 Likes

@feenberg, what compilers do you think are most commonly used to compile TAXSIM? The most portable Fortran 77 compiler I know of is g77. It is easier to find binaries for gfortran.

I haven’t checked lfortran, but flang supports at least some deleted features. E.g. real do variables, branching to endif from outside, assigned gotos, arithmetic if, non-block dos.