Settings

Theme

How Thou Canst Maketh a Fine Program in Fortran

digitalocean.com

97 points by AdamFernandez 9 years ago · 37 comments

Reader

sbierwagen 9 years ago

Needed more https://en.wikipedia.org/wiki/Long_s

Turns

In troth, the Fortran programming language is well suited for those persons who are scientific and who engineer. Named so for the phrase “Formula Translation,” it is a language exquisite for programming machines.

into

In troth, the Fortran programming language is well suited for thoſe perſons who are scientific and who engineer. Named so for the phraſe “Formula Tranſlation,” it is a language exquiſite for programming machines.

Way better.

jejones3141 9 years ago

Author, I pray ye learn Early Modern English verb conjugation, the declension of "thou", and how the occurrence of periphrastic "do" changed with the era, that your titles, headings, and text might fall easily upon the eye and mind of the reader.

(Seriously, nice post, and well done on the title graphic font choice.)

sevensor 9 years ago

Author missed a trick by not using a font with a long S. Also had some trouble declining thee/thou/thy, which is admittedly hard for a modern speaker.

  • acobster 9 years ago

    I never knew the verb decline corresponded with declension. Thanks for that.

  • ironcutter 9 years ago

    What were the issues with the declensions?

    • fusiongyro 9 years ago

      Not the parent, but "your machine" should probably be "thy machine." "Thou compiler" should be "thy compiler." In general, mapping from 3rd to 2nd person, "he" = "thou", "him" = "thee", and "his" = "thy."

      I believe "thou doth do" should just be "thou doth" but I could be mistaken about what "doth" is. :)

      • sevensor 9 years ago

        Yup, that's about the size of it. Also, "canst maketh" is wrong. "Thou canst make" is correctly conjugated. But I pick nits -- I appreciate the attempt to write about FORTRAN as if one were a 16th century scholar translating the instructions from Aramaic. I had a laugh.

      • danblick 9 years ago

        Just to share something I think is fun:

        Modern German has separate formal and informal pronouns ("du bist" vs. "Sie sind") and verbs. English used to have them too ("thou art"/"you are"). Even though people assume "thou" is more formal, it's actually the informal/intimate version.

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

        Apparently we (~Angles/Saxons) also used to have a separate tense for "a group of exactly two of you" and words like "both" (vs all) and "either" (vs any) are residual traces of this.

        https://en.wikipedia.org/wiki/Dual_(grammatical_number)

      • jjtheblunt 9 years ago

        doth is 3rd person singular, so maybe dost ? not sure, have to look it up, 20+ years since I was doing this sort of thing in grad school

    • TJSomething 9 years ago

      Well, one thing I noticed was an inconsistency with "thy" and "thine". Which one you use depends on if the following word starts with a vowel, with "thine" before vowels and "thy" otherwise. For example, the article has "in thy own case", as well as, "output thine data". Some investigation seems to lead me to believe that this a more a matter of style, but I still think it sounds wrong.

      • sverige 9 years ago

        Quite correct. Spoken English abhors glottal stops, and written English reflects that. Still, it is not as consistent as one might wish in the written record, humans being about 85% logical and 15% irrational and language reflecting that, &c.

Insanity 9 years ago

I'm thoroughly surprised to see that Fortran is still being updated (with an upgrade still in the works for next year apperantly). I had no idea.

I'll give it a shot as it seems interesting to at least have worked in it a bit, but I do wonder, where is Fortran used these days?

A quick glance at Tiobe[1] shows that it scored a bit higher than Haskell, Scala and Kotlin. Can anyone explain me why?

[1]: https://www.tiobe.com/tiobe-index/

  • rootbear 9 years ago

    I work at NASA Goddard Space Flight Center and I can tell you that Fortran is indispensable. It is the primary language used in numerical simulations, such as climate, stellar dynamics, cosmology, etc. This is partly due to inertia; scientists don't like to spend time learning new programming languages. Also, the various Fortran libraries used in this work are thoroughly understood and no one wants to change them or port them. Most of the code here is in Fortran 95, which may look odd, but has all the things a reasonable "Structured Programming" language should have. Later versions added some Object Oriented features but I don't think they've caught on much around here.

    I don't personally work in Fortran, but I'm not repelled by the idea. The thing that would attract me to it, as a former computer graphics programmer, is the decent support for arrays. C99 is better than C89, but it's not where Fortran is. Sure, C++ can do it with classes but, goodness me, that is one complex language. One pays a hefty price if all one wants is decent array handling. And speaking of complex, Fortran has had complex numbers for decades. I've never used complex numbers in C99, so I don't know how they compare. I'm hearing murmurs of moving some things to Rust, when it matures, but I think the jury is still out on that.

    I always like to include the quote below in discussions like this:

    “I don’t know what the programming language of the year 2000 will look like, but I know it will be called FORTRAN.” – Charles Anthony Richard Hoare, circa 1982

  • azag0 9 years ago

    Personal experience: My general language-to-go is Python, and I'm very fond of Rust. But Fortran has no competition in numerical computing at native speeds in terms of convenience. I was just recently rewriting a small Fortran library (that I usually but not always call from Python) to C, and it was a pain. So, as a result of that, Fortran is still used heavily in scientific computing. (On the other hand, Fortran is a pain for anything else than numbers and arrays.)

    It is also the only language I'm aware of that has a special syntax for distributed memory [1], making parallel distributed computing potentially extremely convenient.

    [1] https://gcc.gnu.org/wiki/Coarray

    • nickpsecurity 9 years ago

      What do you think about Julia language? It's a modern take on a language for number crunching that has support for C and Python code. Also uses some Fortran libraries that are optimized.

      https://julialang.org

      Far as distributed, see Cray's Chapel and Taft's Parasail for languages trying to improve on that. Chapel's competition was IBM X10 and Fortress languages. Im not sure if those two are maintained any more, though.

  • kdelok 9 years ago

    In general the performance of C vs Fortran is a moot point. However, for numerical performance, Fortran has (at least) two major advantages that I can see, both of which are about usability:

    - In-built support for multi-dimensional arrays and operations on arrays. This makes it so much easier to work with numerical datasets than in C.

    - BLAS and LAPACK are the two foremost packages used for linear algebra. They're written in Fortran, so it's just a bit easier to use them, rather than their C APIs. I've had unpleasant experiences debugging things across the boundary between C and Fortran.

  • simplicio 9 years ago

    I did my dissertation in astrophysics a few years ago using simulations I programmed in Fortran. As others have said, its efficient for number crunching, there's a lot of legacy code in scientific fields and most older Profs are familiar with it.

    Also, as a language, there isn't much to it. If you're already familiar with the basics of programming, you can learn most of what there is to know about Fortran 77 in an afternoon, and pick up later additions to the language as you go. In physics, where the focus is getting grad-students to a point where they can do research quickly, having a language they don't have to spend a month figuring out is an advantage.

    • jcvernaleo 9 years ago

      My dissertation in astrophysics was pretty heavy in FORTRAN too (hydrodynamics simulations). Legacy code, simple language, and really fast compilers.

  • nickpsecurity 9 years ago

    Lots of optimized libraries used in scientific computing are done in Fortran with the language itself making some optimizations easier just because it's more conservative. All the HPC vendors selling supercomputers and such have Fortran on them. The language itself has been updated periodically, too. Add a legacy effect of people just using it for a long time and you get a language that isn't going away.

  • kbenson 9 years ago

    > I do wonder, where is Fortran used these days?

    Not that I actually know, but what I hear is that it's still used for number crunching, and it's actually faster than C in some respects unless you make heavy use of C99 features. That is, very generally it doesn't support a few features of C that makes it easier to optimize some constructs, nut that C now has keywords which can signal the compiler appropriately so the same optimizations can now happen in C.[1]

    I just looked that up from memory of prior discussions here though, so if someone with real experience chimes in, take them over me.

    1: https://stackoverflow.com/questions/146159/is-fortran-easier...

  • love2lol 9 years ago

    It's a language whose syntax makes it easy to pass around multi-dimensional arrays, bounds checking is a standard feature on most compilers, doesn't have the same aliasing problems as C so compilers can do more aggressive optimizations and it compiles directly to your native hardware's instruction set (no vms/sandboxes). Why wouldn't you want that for cpu bound numerical code?

    Also, the PG (now nVidia) Fortran compiler makes it very easy to make your code run on a gpu with only adding some attributes to variables and some pramgas.

  • rpeden 9 years ago

    And COBOL scored higher than Fortran! Interestingly enough, it's still being updated too. COBOL 2014 is the latest ISO standard.

  • pmbailey 9 years ago

    FORTRAN is deeply ingrained in engineering culture. A lot of legacy (and some new development) is written in it. Though, this is slowly shifting with the prevalence of MATLAB in universities.

  • Mikeb85 9 years ago

    Because it's an easy language to pick up and use, and so well optimized that it'll always be blazing fast and parallelized.

  • yarrel 9 years ago

    A lot of very solid code has been written in it over the years and continues to be used as libraries accessed from e.g. R.

  • dagw 9 years ago

    where is Fortran used these days?

    I see a lot or Fortran still being written in various parts of climate and earth science.

jjtheblunt 9 years ago

maketh is 3rd person singular, but should be an infinitive. cutesy middle english "fail"

  • gagege 9 years ago

    Translates to the Gollum-esque "You can makes a fine program in Fortran"

    lol

jimktrains2 9 years ago

I guess I was expecting a little more substance to the post. It seems like a long-winded for the little substance in it.

squozzer 9 years ago

What?!?!?! No separate linking step?!?!?! Heresy, says I.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection