Live data from Hacker News

Learning Fortran (2024)

uncenter.dev

1–10 of 85 posts

Re: Learning Fortran (2024)

#5
> a quick introduction to a few modern Fortran features: declaring variables, printing and reading to and from the terminal, if and select case, and stop

Pretty much sums up this one. Can't say that I agree if/select/stop are "modern" features.

Re: Learning Fortran (2024)

#7
If you're interested in safer code when working with older versions of Fortran, add 'implicit none' at the top. This will eliminate the integer vs. float automatic assignment and make variable definition much tighter. Back when I mucked about with Fortran (previous century really), we tried to do the memory allocation and I/O in C and the compute in Fortran. That would play well with both superscalar and vector machines.

Re: Learning Fortran (2024)

#8
The article did not discuss this, but to me, one of the bigger differences between Fortran and more modern languages is the difference between functions and subroutines. Yes, they are not synonyms in Fortran and serve different purposes. I think this would trip up more people initially than the clunky syntax.

It is also a bit funny that the author complains about older Fortran programs requiring SCREAMING_CASE, when if anything this is an improvement over previous and current practices. Too many Fortran codes have overly terse variable names that often were just single characters or impenetrable abbreviations for obscure terms. I have had to create cheat sheets for each program to figure out what each variable was.

Sun Microsystems had a great quote about this back in the day [1]:

> Consistently separating words by spaces became a general custom about the tenth century A.D., and lasted until about 1957, when FORTRAN 77 abandoned the practice.

[1] https://docs.oracle.com/cd/E19957-01/802-2998/802-2998.pdf

Re: Learning Fortran (2024)

#9
post #8

The article did not discuss this, but to me, one of the bigger differences between Fortran and more modern languages is the difference between functions and subroutines. Yes, they are not synonyms in Fortran and serve different purposes. I think this would trip up more people initially than the clunky syntax. It is also a bit funny that the author complains about older Fortran programs requiring SCREAMING_CASE, when…

Spaces don't matter in fixed-form Fortran source files, so I don't get that at all. And case doesn't matter in either source form.
Post reply on HN