Fleeble Widget (fleeblewidget) wrote,
Fleeble Widget
fleeblewidget

Everything that's wrong with modern Fortran

I'm sure that the geeks reading this are probably thinking "isn't that an oxy-moron?", but they're wrong. These days, Fortran has many of the features you need to program in a modern style, including such new-fangled ideas as object-orientation, parallel processing and pointer manipulation.

The problem, really, is its age. Not that Fortran is really a creaking behemoth; old-school code written in Fortran 66 or Fortran 77 was so simple that very little has had to be deprecated from the old standards - even the much-reviled computed goto will still compile. However, there is a desire amongst the committee members who control where the language goes to make it look familiar to existing Fortran developers, and that is where it all goes wrong. For example, the (soon to be finalised) draft standard for Fortran 2003) allows you to write code that looks like this:

  character(:), allocatable :: s


Care to guess what that little snippet does? I'll give you a clue, it's declaring a variable, but of what type?

Well, here's the equivalent from Java:

  String s;


Yep, the concept of strings has finally come to Fortran. And they made it look like some kind of hellish devil-code. What that little beauty up there means is "I'm declaring an array of characters, but I'm not going to say at this point how long it will be. And I want it to be able to change size after it's first assigned". Which is one way of defining a string, and has the big advantage of reusing existing keywords, but is completely alien to people who have learnt to program in other languages.

Which is why Fortran will probably never shake its image as fusty, out-moded and unsuited for modern programming.
Subscribe

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 3 comments