[Info-vax] Is C++ good in scientific computation? Why did Fortran lose its popularity?
Arne Vajhøj
arne at vajhoej.dk
Sun Jan 24 14:52:13 EST 2021
On 1/23/2021 2:35 PM, ultr... at gmail.com wrote:
> Very good comparison by a Former member of ISO/ANSI J3 Fortran
> Standards Committee begs the question how C ever became the choice to
> do anything
Good question. But luckily it is 20+ years since that was
the case.
> Is C++ good in scientific computation? Why did Fortran lose its
> popularity?
I don't think C and C++ replaced Fortran in scientific
computing.
Fortran is still widely used in that field.
A lot is also done in R and Python, but that because there
is a need for something higher level.
Some is done in C and C++, but I don't think it is more than
what can be considered natural given that it is two mainstream
languages.
There is also some Java, because even though Java has some
problems in this field, then most of the big data foundational
stuff is Java.
> I generally do not consider C++ to be a good choice for scientific
> computation or for many other software application areas. I believe
> that it is “popular” largely because it was one of the first major
> OOP languages and it is closely related to C, the premier low-level
> system programming language.
That seems plausible. First OOP language compatible with existing
code got a huge advantage.
> C++ is a proper superset of C. Among other things, that means that a
> pointer can point at anything. This limits opportunities for
> optimization.
> Fortran has rules that provide lots of opportunities for run-time
> efficiency. A pointer can point only at a target that has either the
> POINTER or TARGET attribute AND is of the same type, kind, and rank.
> This means that non-pointer and non-target data objects can be
> subject to entire classes of additional optimizations.
Considering C/C++ pointers a problem for optimization sounds like
a rather extreme optimization view - I think most people would consider
them a case of efficiency over safety.
> The grammar and
> syntax of C++ is difficult and complex so it is easy even for
> experienced programmers to make serious and costly mistakes. The
> architecture of the OOP features is often clumsy and difficult to
> use.
> The grammar and syntax of Fortran was intentionally
> designed so that it would be easy to use for a non-expert application
> developer.
I tend to agree with the point that simple languages are better than
complex languages.
Cobol, Fortran 66/77 etc. ruled for years and still widely used
with relative simple languages.
C++, Ada 95, Scala and supposedly also PL/I has struggled a bit
and not really delivered on the promised made when created, because
they are complex languages.
But newer Fortran versions are not simple. They jumped on the
big language wagon.
> The ISO committee that developed the next ISO Standard, FORTRAN 77
> had an intense debate over the size and scope of the language. The
> large language people wanted to incorporate many of the features that
> the computer scientists wanted and to relax many of the restrictions
> that existed in FORTRAN 66 such as limiting names to 6 characters.
> The small language people wanted to add only a few select features.
> The small language people generally won the argument. As a result,
> many computer scientists moved away from Fortran and on to other
> languages, first Pascal, then in succession, C, C++, and Java.
Fortran market share was decreasing at that time, but given the
increase in number of languages then that was probably unavoidable.
And Fortran 77 was still a major language.
It was Fortran 90 and 95 that saw the language turn into a
niche language.
> What followed was a 14-year knock-down, drag-out fight over the size
> and scope of the Fortran programming language. Eventually the
> large-language people won and the result was Fortran 90, which was
> published in June 1991. It included a long list of features that had
> proven their worth in the preceding 20 years along with some useful
> features, such as user-defined generic procedures and user-defined
> operators, that are rarely found in other languages.
>
> Unfortunately, the small-language people did not accept defeat
> gracefully. Instead, they launched a scorched-earth resistance and
> harshly criticized the new version of Fortran. Thus, many influential
> people in the software development community turned against Fortran.
> They did not give it a fair chance to compete.
I don't think peoples feelings played so big a role.
The fact is that Fortran 90/95 was a very different language
than Fortran 77. Still pretty compatible and able to compile
Fortran 77 code, but "well written" Fortran 90/95 did not
look like Fortran 77.
And at the time there were many other languages
available.
So if people were to switch to a new language, then
they had to look at what made most sense. Some did
switch to Fortran 90/95. But other chose different
languages.
A big change to language combined with more alternatives
available is a difficult situation.
> Lack of a Politically Powerful Champion. Many of the most successful
> programming languages have a politically powerful champion or
> sponsor. Consider these examples:
>
> C has legions of low-level systems programmers and many computer
> scientists. C++ has Bjarne Stroustrup, many computer scientists, and
> Microsoft. Ada has the US Department of Defense. Visual Basic and C#
> have Microsoft. Java originally had Sun Microsystems and now has
> Oracle.
>
> Fortran has no politically powerful sponsor or champion. There is no
> highly influential person or organization in the software development
> community that is pushing strongly to make Fortran much more popular.
Python only got one person Guido van Rossum.
JavaScript was invented by a company that went bankrupt 18 years ago.
If a language meet a demand then it will succeed.
Arne
More information about the Info-vax
mailing list