Live data from Hacker News

What are Fortran and Cobol used for today?

stackoverflow.com

11–20 of 72 posts

Re: What are Fortran and Cobol used for today?

#11
Scaring baby programmers.

Oh, and lots of scientific computing is done in Fortran - eg. the sorts of work my brother does on atomic structure as a computational chemist at ITU, running on grid or supercomputers.

On the flip side, there's lots of very large, poorly documented programs which are effectively "mission critical" Fortran. Until someone ponies up a LOT of money to re-write and revalidate them, Fortran ain't going away.

Re: What are Fortran and Cobol used for today?

#12
COBOL & RPG = your paycheck or the managing the bank account your money is in.

There is a huge amount of COBOL / RPG processing flat files to do various financial transactions. It works and has worked for decades, so not many folks really have the willpower and cash to rewrite it.

Re: What are Fortran and Cobol used for today?

#13
The best-paid freelance programmer I ever knew was a man older than my dad who was the only guy left in the country that could code Cobol for certain kind of industrial equipment.

For the companies that hired him it was cheaper than changing that equipment, and by cheaper I mean the guy was able to buy an Hacienda with what he made coding Cobol, nuff said.

Re: What are Fortran and Cobol used for today?

#14
post #5

I believe we should think of Fortran as a domain-specific language for handling multidimensional arrays, rather than a normal programming language. It might be terrible for other things, but it's great for array computations, and that's what people use it for in big simulations. Since it has a well-defined C FFI nowadays, it's easy to connect it to other languages that can do other things (parsing data files, etc.).…

Given the right tools[1] you can have as much templating/macro support as in C++ while keeping everything both performant and user friendly. The key here is to wrap Fortran in script languages to make it do exactly what you want. [1] https://github.com/muellermichel/Hybrid-Fortran (I'm the maintainer.)

> while keeping everything both performant

Good luck beating the performance of a Fortran optimizing compiler.

Re: What are Fortran and Cobol used for today?

#15
I really like the top two answers.

A few points, when I was in school and that was only 5 years ago, I learned Fortran. I learned it because I was starting as a Mechanical Engineer, and one of the heat transfer classes involved solving differential equations via programs. If you wanted to get help from the egg head professors you had to take Fortran because that's what they knew. The Fortran class was Mechanical Engineers and Nuclear Engineers. I believe we were working in Fortran 77 & 90.

One of my friends from college is working on his PhD in physics. He spends his summers and breaks in Los Almos labs, and uses particle accelerators. Anyway - he told me that they use Fortran for their calculations purely because it was easier to translate to the language and it's all math.

Anyway that's just my $.02

Re: What are Fortran and Cobol used for today?

#17
post #4

I was surprised to see when I installed R for the first time, that a large amount of the libraries it makes use of are written in fortran. To complete the installation required me to choose from one of several current and compatible fortran compilers even. So at least for fortran, the answer is scientific computing.

Fortran is far from extinct, because scientists often prefer it to C/C++, and it's often faster. Part of the reason is that Fortran passes arrays by value, while C passes them by reference. It's very hard for compilers to optimise a pass-by-reference array, because it might have the memory altered by another part of the program. If it's pass by value, then you know it's safe. It's kind of like threads vs messages. I…

Part of the reason is that Fortran passes arrays by value, while C passes them by reference.

Actually, the reason is that Fortran arguments may not alias (passing big arrays by value would be horribly inefficient).

Btw, one of the main goals of C99 was making C a better language for numerics (ie catching up to Fortran): The restrict qualifier was introduced (mainly to mark non-aliasing parameters) as well as complex numbers, variable-length arrays and type-generic math functions.

Re: What are Fortran and Cobol used for today?

#18

I was surprised to see when I installed R for the first time, that a large amount of the libraries it makes use of are written in fortran. To complete the installation required me to choose from one of several current and compatible fortran compilers even. So at least for fortran, the answer is scientific computing.

A lot of NumPy/SciPy (Python's scientific computation libraries) are written in Fortran too: http://docs.scipy.org/doc/numpy/user/install.html

Yup, mostly because they are the same libraries that R uses. I really feel like I may need to learn Fortran at some point, given its ridiculously good numerical capabilities.

Re: What are Fortran and Cobol used for today?

#19
post #5

I believe we should think of Fortran as a domain-specific language for handling multidimensional arrays, rather than a normal programming language. It might be terrible for other things, but it's great for array computations, and that's what people use it for in big simulations. Since it has a well-defined C FFI nowadays, it's easy to connect it to other languages that can do other things (parsing data files, etc.).…

why is FORTRAN "terrible for other things" given that it has a lot of useful features for technical programming that more modern languages lack.

You could always look at ratfor if you need to do a lot of character based stuff.

Back in the day I even wrote billing systems and a device driver for PDP's using fortran.

Re: What are Fortran and Cobol used for today?

#20
I use Fortran every day for fluid dynamics research. Fortran is the abusive partner you keep going back to. If C had array operations and aliasing restrictions I would switch in a heartbeat. As it is the syntax "a=b" is a lot better than four nested for loops and hence 4 opportunities to fuck up the indices.
Post reply on HN