# Anecdotal Fortran... :-)

**URL:** <https://fortran-lang.discourse.group/t/anecdotal-fortran/704>\
**Category:** Uncategorized\
**Created:** [February 11, 2021, 5:58pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704 "2021-02-11T17:58:03Z")\
**Posts on this page:** 20\
**Page:** 11

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [May 11, 2022, 5:31pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/211 "2022-05-11T17:31:47Z")

</div>

> [@milancurcic](#):
>
> Input: Reason, Output: Pleasure. A Fortran board game: [Fortran | Board Game | BoardGameGeek](https://boardgamegeek.com/boardgame/17948/fortran)

Its logo is used at the top of the [LinkedIn Fortran Programmers group](https://www.linkedin.com/groups/145550/)!

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [May 11, 2022, 7:10pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/212 "2022-05-11T19:10:51Z")

</div>

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!”

[![](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/d/d5419a2597f82d12af3915d690591606ba3d9b2a.jpeg "The Man Who Came to Be Dinner (2015)") ](https://www.youtube.com/watch?v=kMQvC03Wx50&t=83)

---

<div class="post-metadata">

**Author:** ![wyphan](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/wyphan/32/632_2.png) [@wyphan](https://fortran-lang.discourse.group/u/wyphan)\
**Post date:** [May 11, 2022, 8:36pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/213 "2022-05-11T20:36:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [May 18, 2022, 2:21am UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/214 "2022-05-18T02:21:54Z")

</div>

[Operator precedence by textual substitution: A technique from early Fortran](https://www.kmjn.org/notes/operator_precedence_fortran.html)  
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.

…

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [May 18, 2022, 5:01pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/215 "2022-05-18T17:01:44Z")

</div>

> [@Beliavsky](#):
>
> [Operator precedence by textual substitution: A technique from early Fortran](https://www.kmjn.org/notes/operator_precedence_fortran.html)

_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. 😆

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [May 18, 2022, 8:04pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/216 "2022-05-18T20:04:53Z")

</div>

> [@Pap](#):
>
> I wonder how many punch cards were needed for just one “real world” expression.

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](https://www.amazon.com/Abstracting-Away-Machine-Programming-TRANslation/dp/1082395943) (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.

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [May 19, 2022, 6:35am UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/217 "2022-05-19T06:35:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [May 21, 2022, 10:54pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/218 "2022-05-21T22:54:45Z")

</div>

[A. Michael Noll Pioneers Computer Art in the United States](https://historyofinformation.com/detail.php?id=3979)

> "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](http://noll.uscannenberg.org/) with computer art.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [June 8, 2022, 6:17pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/219 "2022-06-08T18:17:52Z")

</div>

[Colossal Cave Adventure](https://en.wikipedia.org/wiki/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.

> **[GitHub - ghfbsd/adventure: The ancestral computer game, circa 1976.](https://github.com/ghfbsd/adventure)**
>
> The ancestral computer game, circa 1976. Contribute to ghfbsd/adventure development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![milancurcic](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/milancurcic/32/2_2.png) [@milancurcic](https://fortran-lang.discourse.group/u/milancurcic)\
**Post date:** [June 8, 2022, 7:21pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/220 "2022-06-08T19:21:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wyphan](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/wyphan/32/632_2.png) [@wyphan](https://fortran-lang.discourse.group/u/wyphan)\
**Post date:** [June 11, 2022, 12:53pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/221 "2022-06-11T12:53:00Z")

</div>

Just released yesterday: “Fortran in 100 seconds”  
Edit: discussion thread here: [Fortran in 100 Seconds](https://fortran-lang.discourse.group/t/fortran-in-100-seconds/3718)

[![](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/5/5471389b07ad79fe86ac4ad0ac6ee0566084e81d.jpeg "FORTRAN in 100 Seconds") ](https://www.youtube.com/watch?v=NMWzgy8FsKs)

---

<div class="post-metadata">

**Author:** ![interkosmos](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/interkosmos/32/296_2.png) [@interkosmos](https://fortran-lang.discourse.group/u/interkosmos)\
**Post date:** [July 21, 2022, 12:36pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/222 "2022-07-21T12:36:26Z")

</div>

[taxsim.app](https://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](https://news.ycombinator.com/item?id=31925871):

> [@](#):
>
> All the calculations occur directly in the browser, and are powered by a Fortran program that has been converted to WASM using emscripten. This calculator was originally developed in the 1970s [1] by the non-profit National Bureau of Economic Research. NBER has been maintaining this F77 codebase for the last 50 years, and uses it primarily for academic research on tax policy. The Fortran source code itself is over 1MB of text, because it codifies both federal and all 50 states’ tax laws for each of the last 62 years.
> 
> I first learned about NBER TAXSIM [2] a few months ago via an interesting paper they published “Automatic Tax Filing: Simulating a Pre-Populated Form 1040” [3]. The Fortran code itself is not open-source, but is available on request for research purposes. I reached out to NBER and proposed compiling it to WASM, so it could be run directly in a browser. With relatively little effort I was able to create a js/wasm version [4], thanks in huge part to previous open-source work [5].

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [July 21, 2022, 1:41pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/223 "2022-07-21T13:41:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![feenberg](https://avatars.discourse-cdn.com/v4/letter/f/c2a13f/32.png) [@feenberg](https://fortran-lang.discourse.group/u/feenberg)\
**Post date:** [July 21, 2022, 2:44pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/224 "2022-07-21T14:44:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [July 21, 2022, 5:50pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/225 "2022-07-21T17:50:30Z")

</div>

Is Fortran still used by finance/economics academics nowadays?

---

<div class="post-metadata">

**Author:** ![MarDie](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mardie/32/54_2.png) [@MarDie](https://fortran-lang.discourse.group/u/MarDie)\
**Post date:** [July 22, 2022, 2:09pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/227 "2022-07-22T14:09:17Z")

</div>

> [@feenberg](#):
>
> 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.

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

> [@feenberg](#):
>
> 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.

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

> [@feenberg](#):
>
> 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.

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

> [@feenberg](#):
>
> Developers in the tech sector often have considerable freedom. Policy analysts in US executive agencies often have none.

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.

---

<div class="post-metadata">

**Author:** ![MarDie](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mardie/32/54_2.png) [@MarDie](https://fortran-lang.discourse.group/u/MarDie)\
**Post date:** [July 22, 2022, 2:15pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/228 "2022-07-22T14:15:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![feenberg](https://avatars.discourse-cdn.com/v4/letter/f/c2a13f/32.png) [@feenberg](https://fortran-lang.discourse.group/u/feenberg)\
**Post date:** [July 22, 2022, 5:28pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/230 "2022-07-22T17:28:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [July 22, 2022, 5:43pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/231 "2022-07-22T17:43:50Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![ashe](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@ashe](https://fortran-lang.discourse.group/u/ashe)\
**Post date:** [July 22, 2022, 5:51pm UTC](https://fortran-lang.discourse.group/t/anecdotal-fortran/704/232 "2022-07-22T17:51:29Z")

</div>

> [@kargl](#):
>
> You’re missing the point. lfortran and flang are new compilers, which are being written from scratch. Do these compilers have a -std=legacy option? If a feature is removed from the Fortran standard, why waste time implementing it? I can assure you that if fixed-form source code were removed, new compilers will not implement.

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

[Previous page](https://fortran-lang.discourse.group/t/anecdotal-fortran/704.md?page=10)

[Next page](https://fortran-lang.discourse.group/t/anecdotal-fortran/704.md?page=12)
