On Sun, Dec 2, 2018 at 5:18 PM Dave Horsfall <dave(a)horsfall.org> wrote:
Yeah, it was a nice language at the time; the
engineers loved it,
Dave at this risk of piling-on, I feel like to I need to comment because
while I personally to not use it, my customers do. It's still an excellent
tool, and the reality is that Fortran has pretty much paid my salary for
almost every computer firm I have worked since I left grad school. That's
5 start-ups and too many large firms to count.
Fortran2018 (which was release just last week BTW) is hardly the language I
learned in the early 1970s (Fortran-IV) or my father a dozen or so years
previous to me. Knocking modern Fortran is sort of like saying, "Any
vehicle that is made by Ford sucks because the Model T was not as good as
what we can do today." I fear your are making statements about Fortran-2 -
maybe 77 or even 90. But the language is niether dead nor useless.
Check out an answer I did for quora last summer: Clem Cole's answer to Is
the future of Fortran Programming Dead
<https://www.quora.com/Is-the-future-of-Fortran-programming-dead/answer/Clem-Cole>
I also point out, if you watch the nightly news on TV, you are using
Fortran. Pretty much, all the weather data internationally is crunched on
Fortran codes. The same is true for most 'large science.' As for why we
will still use it is that *the work (the math) has not changed (If it ain’t
broke, don’t fix it). And most importantly, history has shown that it has
never been economically interesting to bother (or at least so far).* Please
read my Quora answers to see a much more detailed analysis of that
statement.
but tthe computer scientists hated it
I get it. But ... at least we were taught it. I'm saddened to say my
fairly recent CS major daughter was never shown it in her days in college.
In a funny twist of fate, her grandfather (my Dad) was taught Fortran in
1958 at a course at her college (Carleton) via an NSF grant.
As I have said elsewhere, in the 70's the CMU CS Dept, was arguing with the
Engineering school. In those days, the CS Dept said, "Fortran was dead."
But like the Phoenix, it is seems to get be getting more beautiful and
stronger with each reincarnation.
(have you ever tried to debug a FORTRAN program that
somebody else wrote?).
Hrrumft. You can write bad code is *any* language. See the annual
obscure C prize. FWIW: This little gem is legal Fortran-IV. The last
time I compiled it on my Mac, a Fortran2013 draft comforming compiler, Intel
Fortran's ifort, will accept thios deck also with no special switches
BTW. That said, the last time I checked it on my Mac, ifort generated
incorrect code (it was reported as a bug, I'm not sure of the status of the
fix and I have not updated the compiler since last summer):
C This FORTRAN program may be compiled and run on a Norsk Data
C computer running SINTRAN and the FTN compiler. It uses only
C FORTRAN reserved words, and contains just one numerical
C constant, in a character string (a format specifier). When
C you run it, it prints a well known mathematical construct...
C
C Even FORTRAN is a block structured programming language:
C
PROGRAM
;PROGRAM;INTEGERIF,INTEGER,GOTO,IMPLICIT;REALREAL,DIMENSION,EXTERNA
AL,FORMAT,END;INTEGERLOGICAL;REALCOMPLEX,DATA,CALL,ASSIGN,CHARACTER
R;DOFORIF=INTEGER,INTEGER;ENDDO;INTEGER=IF+IF;GOTO=INTEGER*INTEGER*
*INTEGER*INTEGER-INTEGER-IF;CALLFUNCTION(IMPLICIT,REAL,DIMENSION,EX
XTERNAL,FORMAT,END,LOGICAL,COMPLEX,DATA,CALL,ASSIGN,CHARACTER);CALL
LSUBROUTINE(IMPLICIT,LOGICAL,GOTO,IF,INTEGER);END;SUBROUTINEFUNCTIO
ON(IMPLICIT,REAL,DIMENSION,EXTERNAL,FORMAT,END,LOGICAL,COMPLEX,DATA
A,CALL,ASSIGN,CHARACTER);RETURN;END;SUBROUTINESUBROUTINE(IMPLICIT,L
LOGICAL,GOTO,IF,INTEGER);INTEGERGOTO,IMPLICIT(GOTO),LOGICAL(GOTO),I
IF,INTEGER,EXTERNAL,RETURN;DOFOREXTERNAL=IF,GOTO;DOFORRETURN=INTEGE
ER,EXTERNAL-IF;IMPLICIT(RETURN)=LOGICAL(RETURN)+LOGICAL(RETURN-IF);
;ENDDO;IMPLICIT(IF)=IF;IMPLICIT(EXTERNAL)=IF;DOFORRETURN=IF,GOTO-EX
XTERNAL;WRITE(IF,'(''$
'')');ENDDO;DOFORRETURN=IF,EXTERNAL;WRITE(I
IF,'(''$''I4)')IMPLICIT(RETURN);ENDDO;WRITE(IF,'(
/)');DOFORRETURN=
=IF,GOTO;LOGICAL(RETURN)=IMPLICIT(RETURN);ENDDO;ENDDO;END
The output should be something like this:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
1 10 45 120 210 252 210 120 45 10 1
1 11 55 165 330 462 462 330 165 55 11 1
1 12 66 220 495 792 924 792 495 220 66 12 1
I admit, I'm glad I'm not a compiler writer. But they do have an amazing
product that is very useful to a lot of people and still quite popular.
BTW: Here is the same program, in a bit more readable form:
PROGRAM BLOCK
INTEGER I1,I2,I3,I4,I5
DIMENSION I1(13),I2(13)
I4=1
I5=2
I3=13
CALL PASCAL(I1,I2,I3,I4,I5)
END
SUBROUTINE PASCAL(IP1,IP2,IP3,IP4,IP5)
INTEGER IP3,IP1(IP3),IP2(IP3),IP4,IP5
INTEGER IP6,IP7
DO IP6=IP4,IP3
DO IP7=IP5,IP6-IP4
IP1(IP7)=IP2(IP7)+IP2(IP7-IP4)
ENDDO
IP1(IP4)=IP4
IP1(IP6)=IP4
DO IP7=IP4,IP3-IP6
WRITE(*,'(" "$)')
ENDDO
DO IP7=IP4,IP6
WRITE(*,'(I4$)') IP1(IP7)
ENDDO
WRITE(*,*)
DO IP7=IP4,IP3
IP2(IP7)=IP1(IP7)
ENDDO
ENDDO
END
ᐧ