News for hackers. Stuff that matters.
Re:Don't hate COBOL until you've tried it by CyberDildonics on Friday October 27, 2017 @05:51PM (#15572506)
Shouldn't it be possible to convert COBOL to C C++ LLVM IR or even WebASM?
Re:Don't hate COBOL until you've tried it by waltman on Saturday October 28, 2017 @02:38PM (#15576179)
It’s certainly possible; after all, the GnuCOBOL compiler is written in C. A large part of every COBOL program tends to be simple move and arithmetic statements that seem like they should be easy to port. The difficulty comes with the data declarations. COBOL’s pic statements don’t just define length and whether or not they’re numeric. They also come with complex behaviors that are enforced at run time. For example, anything that’s a pic 9 is stored as a sequence of 0-padded text digits, but you can also do arithmetic on them. They work like a car odometer in that if you add 1 to a variable that’s all 9’s, the result is all 0’s. They also allow you to do arithmetic on currency amounts (like I do in the article) exactly, without having to worry about IEEE floating point round off errors. That’s another reason the banking industry likes COBOL.
Re:Don't hate COBOL until you've tried it by CyberDildonics on Saturday October 28, 2017 @03:24PM (#15576399)
Wouldn't that just mean using functions to have the same results?
Re:Don't hate COBOL until you've tried it by waltman on Saturday October 28, 2017 @04:00PM (#15576537)
Sure. My point was just that it's more difficult than it seems. Also this would mean that lines like

add x to y giving z

become something like

cobol_add_giving(&a, &b, &c);

which is a lot less readable.

Re:Don't hate COBOL until you've tried it by TomMarius on Saturday October 28, 2017 @08:47AM (#15574978)
It's possible but no one dares to because it might cost literally millions if a bug shows up.