Extigy a day ago

One of my favourite features of Fortran is in its array implementation. You can index arrays however you like.

Do you like your initial value to be at index 1? Cool. Prefer to index arrays from 0 instead? Sure, go ahead.

How about an array with indexing symmetric around zero?

    double precision :: arr(-100:100)
Beautiful!
  • pjmlp 19 hours ago

    Pascal derived languages also enjoy this capability.

    Your example across most of them is something like:

        type 
            precision = array [-100..100] of double;
    • pklausler 17 hours ago

      Arrays are actually not part of Fortran’s type system; neither are pointers. These are attributes of variables and components, instead.

      And the language has some nasty pitfalls for users (and some nonportable cases due to bugs in some compilers) with non-default lower bounds. A simple assignment statement like A=B might change the bounds of A, but A=(B) and A(:)=B cannot. It’s best to avoid non-default lower bounds in general.

      • pjmlp 16 hours ago

        As described on the linked article....

        • pklausler 15 hours ago

          I wrote it.

          • pjmlp 14 hours ago

            Great, it isn't as if I pay attention to the nicknames and the authors of the articles, and your reply was formulated in a way that came for as if was someone replying to me without having read the article, hence why I replied like that.

            Interesting article.

SoftTalker a day ago

Still used in scientific computing. Perhaps also in some financial settings? Otherwise it’s pretty dead.

  • pjmlp a day ago

    That narrow minded approach is one of the reasons OpenCL lost to CUDA, by not taking Fortran support seriously.

    I was on a OpenCL Webminar panel, where Khronos folks said exactly the same thing.

    Meanwhile, NVidia's investment into PGI compilers really paid itself out.

  • johnisgood a day ago

    Real programmers use Fortran! (Reference to that old saying.)

    I do not think Fortran is dead though.

  • almostgotcaught a day ago

    It's always the people that are chronically online here that comment with most lowbrow stuff. Yes Fortran is so dead that NVIDIA and Intel are both building new compilers for it

    https://www.intel.com/content/www/us/en/developer/articles/r...

    https://developer.nvidia.com/cuda-fortran

    https://flang.llvm.org/docs/

    • xeonmc a day ago

      To be fair, in frontendland a framework is considered dead if it hasn’t updated for more than two weeks.

    • pjmlp a day ago

      As I point out in a sibling comment, it was definitely one of the reasons OpenCL lost, not being able to dump Fortran HPC workloads into GPUs.

  • 90s_dev a day ago

    I hate to be superficial, but languages without braces just feel weird to me. I can use them and have even for a paycheck, but... no thanks. Even Lua, one of my favorite languages (if not #1), always feels at least slightly weird when I use it because of do/end.

    • timonoko 16 hours ago

      Sorry Son, but those were introduced very late in B and C languages. Algol, Simula etc used Begin-End.

      Curly Brackets were horrible choice, because in civilized countries they were already used as ÄÖÅÜ - characters.

timonoko a day ago

CONTINUE - card was eternal mystery. Why cant you have just empty card with line number on it?

  • mystified5016 17 hours ago

    Probably for the humans writing, sorting, and manipulating the cards. A big fat stack of cards isn't like a floppy disk, it requires active care and feeding, and you'd better not drop it

    • pklausler 17 hours ago

      Pro tip for time travelers to the 60’s: take a marker pen and draw a diagonal line across the top of your card deck, from column 1 on the first card to column 80 on the last one. It’ll help you sort things out later when you drop it.

jmclnx a day ago

Very nice, my first professional job was with Fortran IV, but my 19 year old self made lots of mistakes back then :)

Anyway I eventually ended up with c. Recently I started playing with gfortran, but so much have leaked out of me I have been having a tough time of it. I expect this will help me a lot!

Edit: No functions ? OK, noticed it is handled under Subprograms. Seems there have been many changes.

readthenotes1 a day ago

I haven't used a modern Fortran, but for older versions , the biggest surprise was the lack of reentrance.

  • johnisgood a day ago
  • adrian_b a day ago

    Indeed, reentrance and recursivity and the use of stacks and/or heaps for dynamic memory allocation have appeared in programming languages that have descendants still used today only in 1960, in ALGOL 60 and LISP I. These features have become ubiquitous in the later programming languages, all of which have been at least partially inspired by ALGOL or LISP.

    Fortran is the only surviving programming language older than that (first specification in 1954 and first implementation in 1956). Cobol is the only surviving programming language equally old with LISP and ALGOL, so that it has not been influenced by either of them. Thus now Fortran and Cobol are the only surviving programming languages from the era when only static memory allocation was used in programs, though their later versions have added most modern programming language features.

    • pjmlp a day ago

      Depending on where you place them, there are still some folks having to deal with NEWP, PL/I and RPG, which are of similar vintage.

      • adrian_b 19 hours ago

        PL/I was released in 1965 and it was designed during 1964, i.e. much later than ALGOL and LISP.

        Moreover, it has been explicitly designed with the purpose of combining the best features of ALGOL, FORTRAN and COBOL. It has also added heap-based dynamic memory allocation like in LISP, but for deterministic behavior it has introduced the equivalent of "malloc" and "free", instead of using a garbage collector (manual memory allocation management is thus younger than both the use of garbage collectors and of reference counting, both of which have been in use since 1960).

        Therefore PL/I is clearly a language derived from ALGOL and LISP, besides FORTRAN and COBOL. PL/I is also one of the 3 sources from which the C language has inherited, besides BCPL and ALGOL 68.

        RPG (Report Program Generator, 1959) is indeed old, but it is a special-purpose programming language, like SQL, not a general-purpose programming language.

        I have never encountered NEWP, but AFAIK it is a much more recent language, from the seventies.

        While almost all general-purpose programming languages designed after 1960 have incorporated the features introduced by ALGOL and LISP, such as block structure with local variables dynamically-allocated in a stack, allowing reentrancy and recursivity, and also with heap-allocated variables without restrictions on the freeing order, there have also been various languages with limited purpose, which have been kept intentionally very simple, by omitting many of the features of standard programming languages. However for such more recent simplified languages, omitting features has been a design target, while in the languages from the fifties such features were missing not because they were not desired, but because it was not yet clear how to implement them.

        • pjmlp 19 hours ago

          NEWP is from the early 1960's, it is the evolution of ESPOL used in Burroughs, released in 1961.

          As for the rest, I hardly consider 1960's languages, only a decade older than original ALGOL and LISP, when most knowledge sharing was only done via conferences, scientific papers, or people moving between universities and companies research labs that much different, in age and industry impact they contributed to.

          On the other hand, we are still fighting to get mainstream systems programing as safer as those languages in late 1950's, early 1960's, allowed for.

          Or as interactive as LISP for that matter, including the whole jump into debugger and redo kind of workflow.

  • timonoko 16 hours ago

    If you had to be weird you added RECURSIVE-word into the function definition. Then it failed somewhat gracefully. Otherwise your self-referencing program destroyed the machine. In large organization you could not be sure on what machine the stack was run and what version of Fortran it had.