logoalt Hacker News

Learning the oldest programming language (2024)

34 pointsby lioeterstoday at 1:25 PM37 commentsview on HN

Comments

sdsdtoday at 8:48 PM

Semi-related, I've wanted to learn Plankalkül for some time but have had immense difficulty "getting it". Has anyone on here gotten the hang of it?

atretteltoday at 5:14 PM

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

show 2 replies
dhosektoday at 8:17 PM

Just looking at Fortran code fills the back of my mouth with the sensation I got from being around the printed IBM manuals in the basement computer lab at UIC of being around dust and powdered printer paper.

thatjoeoverthrtoday at 6:38 PM

I actually had a fantastic experience with Fortran lately. I ported a compute kernel from python/numpy to Fortran 2018, partially due to the GIL and partly so I could use Intel's compiler. The performance improvement was tremendous. Several times faster per core, then multiplying further because I could take advantage of threading. In all, the 3 day project increased actual throughput 450x.

(I considered JAX, but the code in question was not amenable to a compute graph. Another option was to thread by fork, and use IPC.)

I liked the language itself more than expected. You have something like "generics" with tensors. Suppose you pass a parameter, N, and you also would like to pass a tensor, and you would like to specify the tensor's shape (N, N). You can do this; the parameter type constraints can reference other parameters.

Tensors and various operations are first-class types, so the compiler can optimise operations easily for the system you're building on. In my case, I got 80% improvement from ifx over gfortran.

Invocation from Python was basically the same as a C library. Both Python and Fortran have facilities for C interop, and Numpy can be asked to lay out tensors in a Fortran compatible way.

Part of what eased the port was that Numpy seems to be a kind of "Fortran wrapper". The ergonomics on tensor addressing, slicing and views is identical.

show 2 replies
fithisuxtoday at 8:49 PM

Very good choice. Focus on the newest standard.

stevenjgarnertoday at 8:26 PM

One of oldest HIGH-LEVEL programming languages. "Programming" originally meant physically flipping switches or plugging cables into boards. Eventually, this moved to binary (1s and 0s), and eventually to Assembly.

show 1 reply
vatsachaktoday at 7:22 PM

I can't believe they thought so hard about how threads work in the first programming language

https://en.wikipedia.org/wiki/Jacquard_machine

show 1 reply
silverfrosttoday at 8:21 PM

Real programmers can write FORTRAN in any language...

jleyanktoday at 5:06 PM

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.

show 2 replies
RyanODtoday at 7:35 PM

First language I learned while in college in the 1990s. While I enjoyed the class, I have a funny picture of me kicking the FORTRAN book across my dorm room after I turned in my final project.

5555624today at 6:03 PM

This makes me feel old. I learned Fortran on the Dartmouth Time-Sharing System back in 1980. While I think of Fortran now and again and think about re-learning, I haven't thought of DTSS in years.

Hizonnertoday at 6:22 PM

I'm not sure one line of that would compile in FORTRAN 66, even if you indented it properly. Been so long I'm not sure...

turing_completetoday at 1:40 PM

I was expecting Plankalkül: https://en.wikipedia.org/wiki/Plankalk%C3%BCl

show 1 reply
aj7today at 5:52 PM

Arrays that actually make sense!

dizzanttoday at 1:41 PM

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

vzalivatoday at 4:50 PM

This is an excellent idea. But I wold go with Fortran 4 if you looking at authenticity.

ginkotoday at 1:34 PM

I expected this to be about Plankalkül or something devised by Babbage.

show 2 replies
self_awarenesstoday at 6:09 PM

Why not COBOL?

show 2 replies