New Fortran programmer saying hi (and some thoughts on advocacy)

Hello, everyone, and thank you for having me. I just started learning Fortran a few weeks ago, and after lurking on this forum for a while, I figure some people here would like to hear my story.

I’m not a scientist, engineer, statistician or anything of the sort. In fact learning Fortran was kind of an accident for me. Earlier this spring I decided to read a bunch of stuff about classic programming languages, just to see what they can teach me. Turns out, Ada and Cobol have a lot to offer in the way of education, but learning them for real would be involved and not worth it unless there’s a real need.

Fortran is different. It clicked for me. Found myself learning the language almost without meaning to. Last time that happened was with Python. That’s been my go-to language for fifteen years, because it’s so damn convenient. But Python takes longer to start up every time than GFortran does to load from disk with an empty cache. You can literally do iterative development faster in Fortran than Python, and don’t even get me started on how long C++ takes to build even trivial programs, never mind anything big.

Speaking of which: after going through a bunch of other compiled languages, I had settled on C++ at last, for certain tasks. But I wasn’t fully satisfied, and remained on the lookout for alternatives. It’s always good to have alternatives. Found one, too, where least expected.

As of this writing, I’m yet to finish even one real program in Fortran. Been hammering on yet another port of a game that already exists in too many editions. (I did end up with a trivial module for ANSI escape codes along the way.) Things could still go pear-shaped. But so far the language seems well-suited to the task. Even string support isn’t much worse than in Basic for example, and certainly superior to C. Well, it turns out that some features GFortran has had for years were only standardized in 2023, but people complain enough about the standard around here as it is.

My point: a lot more people would be happy to try the language, and some of them would even stay; I told my friends about it, and they thought it was a cool thing to learn. But they thought Fortran was still stuck in 1977: a retrocomputing curiosity, not a modern, competitive tool for making useful software in 2024. Which is weird, because it was easy enough for me to find resources like:

  • the fortran-lang community;
  • the fortran wiki;
  • the Cyber Vanguard’s guide to modern Fortran

and others. But most people don’t even think to go looking, apparently, and I’m not sure what could be done about it.

Sorry for all the rambling. This might belong in Advocacy after all. Hope you’ll find it useful.

19 Likes

Welcome to the forum and thank you for the kind words about Fortran as a language. If you are looking for a small project to get more hands on experience, I am sure there are enough people here who can suggest something - like the open issues in the stdlib project?

2 Likes

Welcome @nosycat ,

it seems the English word for what you describe is prejudice (or bias) and the only answer is: working, working, working…

Maybe? I was thinking ignorance, but who knows. As an interesting coincidence, if you tell most people today about text adventures, they think you mean Zork, also from 1977. As the meme goes: if I had a penny for every time this happened, I’d have two pennies, but it’s strange that it happened twice.

1 Like

Prejudice is worse than ignorance, as you think you know something whereas you don’t. And it is far more dangerous than ignorance, as it will be very difficult for you to acknowledge you are wrong and change your mind.

Thank you very much for the suggestion, but are you sure it’s a good idea for a complete beginner to jump in at the deep end and start contributing to a crucial community project?

I do not expect you to become an expert in this overnight :slight_smile: But we have a large number of issues that can use a caring eye and it will give you the opportunity to see actual code instead of toys. And many issues do not require smart, extensive programming, but an analysis of what is wrong or what could be the cause. And you would not be alone.

I’m not sure how popular ADA is nowadays, but it is worthy to learn about. Modern Fortran (Fortran-90 onwards) has adopted lot of the same capabilities. Yet ADA offers more. (E.g., exceptions, generics, different concurrency model, many standard packages and modules, containers, etc.)

Unless you really want to learn about decimal data types, and you could do that with ADA, don’t bother with COBOL. The language is a mess. Though every now and then I hear of some organization offering big bucks for COBOL programmers because the people who knew their system retired, and changes needed to be made…

1 Like

It was definitely worth learning theoretically, and I noticed the cross-pollination (with other modern languages, too). But Ada is a lot bigger and more involved, so you pay a hefty price for the features it offers. As for popularity, there’s an ecosystem, and a community gathered around Alire, their semi-official package manager. Could be another option in the future, but for now I ended up here instead.

Hi @nosycat, maybe this can come in handy for your learning adventure Stdlib in Compiler Explorer

2 Likes

I did not realize that ADA had all of this! Quite impressive for a language that is even more a niche one than Fortran…

Fortran’s OOP facilities are very similar, and they were added several years later. There’s a clear line of succession going all the way back to Object Pascal. Meanwhile curly-brace languages went down a different path for several decades, but Ada’s influence is felt in other modern languages, too. This deserves to be better known, and it apparently is – in (European) academic circles, not so much elsewhere. But that’s why we’re here.

Belated edit: as for “niche”, isn’t that a self-fulfilling prophecy?

1 Like

?

I looked at those 70s games recently - Advent, Zork etc. Old Fortran games!

I think that genre only appeals to a small subset of gamers - but there was a “golden” age when text games were the only feasible games. Graphics required too much memory.

Advent has been ported several times to other languages - perhaps most famously by Knuth.

Someone may have the appetite to do an update to modern Fortran. The old original sources are here:

There are tons of ports, including to C, Z-Code and Fortran 77 (which the original game otherwise predates). See on IFWiki. And I was thinking how much easier it would be in modern Fortran. But my WIP is a port of my pet Trek clone, which was surprisingly well received – the terminal-based version more so than others. It’s a surprisingly good fit for the language, and I say this after trying it in several Basic dialects. Not to mention a good pretext to practice: it’s a small game, but not a toy, and trickier than it seems.

And rust - becuase I did one :slight_smile:

My first experience with text adventures was “Hitchhikers Guide to the Galaxy” (on a c64). One of the Infocom titles.

I never really enjoyed playing that game as a kid, but I did find the text interface mindboggling and always wondered how it worked.

Of course it relatively simple, and there is no real language understanding beyond holding an inventory of objects and navigating a “maze”. It is a puzzle game.

I have not followed “interactive fiction” since then but I know it is still around.

I wonder how large language models will impact that genre - there are some new possibilities now.

This is a hot topic of discussion in the interactive fiction community. And you’d be surprised! Infocom’s games were quite sophisticated, much fancier than Advent’s two-word parser. Of course neither can hold a candle to modern text adventure authoring systems; homebrew solutions are generally looked down upon. Frankly I don’t see Fortran becoming popular for it nowadays the way Basic used to be in the 1980s, even if it’s now almost as friendly.

It’s still fun to fool around with ports of old games, like you did, and good advertisement too.

1 Like

I agree, but I think it depends on the programmer - no reason necessarily for a Fortran programmer to reach for something else.

Knuth used C for his version of advent - I think only because he is a good C programmer. He used the macro processor extensively, linked lists, enums, many gotos and hardly any functions - which may raise a few eyebrows if it wasn’t him doing it :slight_smile:

http://www.literateprogramming.com/adventure.pdf

Of course most programmers are not fiction writers and vice versa - that limits the choice of language. In the forum you pointed to I see some are exploring
getting ChatGPT to do the programming. Good luck with that.

I like terminal applications - but if seeking a larger audience that probably doesn’t work. I think Darkroom used javascript.

Rust and other LLVM languages can do that too - because they can compile down to web assembly and be used as web-frontends. Don’t think Fortran would be a good choice there.

Guess literate programming is just different. And yeah! I remember A Dark Room. For maximum mass appeal, sure, web games are the way to go, and nowadays all interactive fiction authoring systems are either web-native (like Twine or Quest) or else they can export to the web like Inform 7 and Ren’Py. LFortran has a build that runs in the browser, too; not sure about emitting WASM yet, but it’s probably on the roadmap, and the language itself is perfectly capable of handling non-numeric tasks. As for games that run in the terminal, you’d be surprised how many people are fans of text-based environments, even young people.