News for hackers. Stuff that matters.
Re:Why Fortran? by noobermin on Sunday November 06, 2022 @10:52PM (#33500930)
That's the point, Fortran today is a DSL for computational science, that's it and mainly what it focuses on today. It is not (if it ever was) a general programming language.
Re:Why Fortran? by pasttense01 on Monday November 07, 2022 @01:53AM (#33502078)
Remember C did not come out until 1972. So in the 1960s your primary options were Fortran, COBOL and assembly language (there were lots of other languages but they were relatively minor languages). Considering the major defects of assembly language there was a significant amount of use of Fortran as a general programming language in conjunction with various libraries.
Re:Why Fortran? by tsimionescu on Monday November 07, 2022 @03:37AM (#33502947)
Various LISPs were a major contender in those times, with various companies selling their own flavors. LISP was the major high-level programming language used for writing operating systems - before C, other OSs were basically written in assembler (though there was at least one written in COBOL, BLIS/COBOL, which seems to have been more or less contemporaneous with C's early life).

FORTRAN was always dedicated to scientific computing, I don't believe it was ever used for system software, so it is a bit apples-to-oranges.

Re:Why Fortran? by skissane on Monday November 07, 2022 @03:45AM (#33503025)
> FORTRAN was always dedicated to scientific computing, I don't believe it was ever used for system software, so it is a bit apples-to-oranges.

Early versions of PRIMOS used FORTRAN as a systems programming language, although later versions switched to Prime's proprietary PL/I dialect (PL/P) and Modula 2.

The reason for the somewhat unusual choice of FORTRAN as a systems programming language? Prime's founders were experienced FORTRAN programmers, so it was the natural choice for them, and in 1972 alternatives were far less established (C was only just being invented)

Re:Why Fortran? by rjsw on Monday November 07, 2022 @07:18AM (#33504857)
I think PL/I has more of a claim to have been used for writing operating systems before C than Lisp.
Re:Why Fortran? by noobermin on Monday November 07, 2022 @03:38AM (#33502959)
I feel like in the history of software, "computational science," while now a niche was then one of the major users or computers in the early days in addition to business and then eventually, computer scientists. That way we (I am a computational physicist) were one of the major users of large computer systems as they replaced computers, that is, actual people who sat in a room manually computing things. It was only natural then in a certain sense one of the first high-level programming languages were suited for scientific applications like calculation and simulation.

I think since f90, modern fortran still is a language well suited to that domain while removing a lot of the cruft (like requiring each line fit on a punch card, things like that, ugh), although the landscape of computing has changed dramatically since with scientists now being relegated to being a niche of computing as a whole. So fortran in that sense is more like a DSL today rather than one of the major use cases for computers, but by luck and history has a lineage with literally the oldest high level language. This is thus more like a historical accident than being something contingent for me. I think the fact that it is suited to computational science is a result, not a cause of it being for scientists (it was designed for us, we didn't find it and build it up or something like that), and the strict aliasing, well, I feel like that's just a lucky break that it was and thus easily optimizable...that and cray, HP et al did make supercomputers to run codes that scientists liked, and thus their architecture and optimizations worked well with fortran codes, and thus the development of both are clearly a coupled situation here.

Anyway, when it comes to today, modern fortran is still a strong language for computational science, specifically for numerical things like simulation and numerical solution and things like that, so when I say, "it is a DSL for computational science today," that encapsulates my opinion succinctly without having to go into the ramble about history, although history is mostly why it is the case today.

Re:Why Fortran? by pjmlp on Monday November 07, 2022 @07:15AM (#33504837)
I wouldn't consider Lisp, Algol-60 and PL/I dialects minor languages.
Re:Why Fortran? by philshem on Monday November 07, 2022 @02:48AM (#33502515)
DSL = domain specific language, in this context

https://en.wikipedia.org/wiki/Domain-specific_language

Re:Why Fortran? by skissane on Monday November 07, 2022 @03:52AM (#33503092)
> It is not (if it ever was) a general programming language.

Colossal Cave Adventure (ADVENT) was written in Fortran.

Zork (aka Dungeon) was originally written in an obscure Lisp dialect invented at MIT, MDL; but Bob Supnik at DEC ported it into Fortran, and that version became widely distributed.

I used to work for a university, where the software which determined whether students had met all their degree requirements to graduate (such software is sometimes called a "degree audit tool"), was written in Fortran. Why? Well, it was a manual paper-based process, then one of the academics kindly volunteered to automate it for them. And he was one of the mathematics lecturers, and Fortran was his favourite language, so that's what he did it in. Some years later he retired, and without him the software became increasingly difficult to maintain – the university no doubt had some Fortran programmers in the physics/maths/engineering/etc departments, but the central administration's IT didn't. They ended up replacing it with some commercial off-the-shelf solution–no idea what that was written in, but almost certainly not Fortran.

Re:Why Fortran? by rad_gruchalski on Monday November 07, 2022 @04:12AM (#33503281)
First Prolog was written in Fortran.
Re:Why Fortran? by falsissime on Tuesday November 08, 2022 @03:53AM (#33517264)
The first Prolog was written in Algol-W. The second one, which was called Prolog I was written in Fortran. See comments for more: https://stackoverflow.com/a/4478969
Re:Why Fortran? by rad_gruchalski on Wednesday November 09, 2022 @03:43PM (#33537553)
Thank you, awesome.
Re:Why Fortran? by 7thaccount on Monday November 07, 2022 @08:16AM (#33505376)
Yes, I could see it being preferable or at least on the same level as Cobol and certainly better than using Assembly for programming text adventures, but surely that's just due to certain limitations of the times. Lisp came out like a year later (not sure how long until you could purchase a lisp machine) and is a much better general purpose language (some would claim it's still unsurpassed). Later we had things like APL, C, Pascal...etc and Fortran was left to numerical work.

All that to say I think Fortran can only claim to be what we call "general purpose" for a very limited window of time in the very early stages of computing.

Re:Why Fortran? by skissane on Monday November 07, 2022 @03:42PM (#33512119)
> Lisp came out like a year later

In the early 1970s, almost every minicomputer had a Fortran compiler. Lisp was much rarer. Pascal had only just been invented and C was only just being invented. If you wanted your software to be as widely portable as possible, your choices were Fortran or Cobol, and no wonder why many preferred the former. (Especially if we are talking about software in academic/research environments, where Fortran was far more common than Cobol.)

This has little to do with Fortran and Lisp's respective years of introduction (1957 vs 1958), but rather how far they'd managed to spread in their first 15 years (almost everywhere for Fortran versus only to a narrow subset of academic research institutions for Lisp.)

Re:Why Fortran? by 7thaccount on Tuesday November 08, 2022 @07:03AM (#33518217)
10 years out of ~70ish total is a pretty limited window in my eyes. I guess that's all a little subjective. Thanks for the additional information though. I figured there was a little more choice in the 70s.
Re:Why Fortran? by comfypotato on Monday November 07, 2022 @04:49AM (#33503625)
Are you saying that computational science boils down to parallel multiplication of arrays? That makes sense to me intuitively, but I’m just checking here.
Re:Why Fortran? by kergonath on Monday November 07, 2022 @07:05AM (#33504779)
Well, quite often yes. At least in the areas I know (computational physics, quantum chemistry, weather and climate modelling, engineering, things like that).

Two other usage patterns I can think of are large strings processing (think bioinformatics and genetics), and things with neural networks (which to be fair would be a natural fit for Fortran, if the libraries were not mainly developed in C++ and accessed from Python). Still, on the HPC facilities I use, number crunching in large arrays dominates used CPU time, and I would say about half of them are in Fortran.

Re:Why Fortran? by myself248 on Monday November 07, 2022 @09:51AM (#33506496)
Does Fortran run on GPUs?
Re:Why Fortran? by dagw on Monday November 07, 2022 @09:58AM (#33506593)
Re:Why Fortran? by TheRealKing on Monday November 07, 2022 @04:06PM (#33512453)
There is also Intel oneAPI Fortran.
Re:Why Fortran? by kergonath on Monday November 07, 2022 @06:58PM (#33514291)
CUDA-Fortran is actually great. The added bits of syntax fit very well in the language, much better than standard CUDA in C or C++.

It’s a shame I never really was in a situation to use it in a real program (also, you had to use PGI, which I have always found sub par), but I have tinkered with it over the years and it is very pleasant to use.

Re:Why Fortran? by anta40 on Monday November 07, 2022 @08:52AM (#33505748)
Perhaps Fortrans wasn't designed as a general purposed programming language. But at least that's what was used by Niklaus Wirth to write the first Pascal compiler... :D