• Slashme@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    2 months ago

    Remember that Fortran has an arithmetic if statement. You can write

    IF (expression) s1, s2, s3
    

    where s1, s2 and s3 are labels. If the expression is negative, it jumps to s1. If it’s 0, to s2 and if it’s positive, to s3.

    It also has goto variable. You can do

    INTEGER a
    ASSIGN 20 TO a
    ASSIGN 17 TO a
    GO TO a
    20 PRINT *, "foo"
    17 PRINT *, "bar"
    

    and it’ll print “bar”. In this snippet of code, everything seems quite logical, but imagine debugging spaghetti code written using these patterns.

    Oh, it also has

    GO TO (s1, s2, ... , sn), N
    

    First, N is converted to an integer. If N is 1, it goes to label s1. If N is 2, it goes to s2. If N is less than 1 or greater than n, it does nothing.

  • neidu3@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 months ago

    Fortran. At least it was comprehensible to a human brain once upon a time. And probably efficiently written.

  • 9point6@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    Isn’t it more COBOL than FORTRAN in terms of getting paid?

    I thought FORTRAN was pretty much exclusively used via SciPy in research & academia these days.

    COBOL is still powering the world economy on mainframes

  • Bubbaonthebeach@lemmy.ca
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 months ago

    Code that has lasted, with some maintenance, for 50+ years vs code that doesn’t work from day 1? What advances we have made!

  • ranzispa@mander.xyz
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    I like Fortran very much, but don’t get me wrong: maintaining Fortran code from 69 must be a huge pain in the ass. It is certainly code written by researchers who have no idea about programming practices. It is sure full of exceptions everywhere, all variables are 2 characters long. The codebase grew over the years and is now several millions lines of code, most of which is the same functionality copied everywhere with slight changes. You have no idea what each subroutine is supposed to do, and it doesn’t help that most algorithms used in there were never published or documented.

    I think I’ll go with the vibe coding for this one.