Open source projects for modern COBOL development
opensource.com
opensource.com
What a vivisection of nasty things!
This is perfect :)
d = a.add(b.mul(c));
instead of d = a + b * c;
Even COBOL's COMPUTE D = A + B * C.
was clearer than Java's OOP notation.They should retrofit it as follows:
interface Addable<T> {
T add(T other);
}
And then make the + apply to any Addable, which can be defined for the boxed primitives. And so on for the other operators.A java string added to anything results in the toString() method being called. It doesn't matter if the string is before or after the + operator. How do you specify precedence in this new scheme short of an exponentially large `add` method handling all the cases. And each add method has to handle all the variety of cases.
interface Addable<RHS, Result> {
Result add(RHS other);
}
The problem is hardly new though. Groovy is very Java-like and has operator overloading: http://groovy-lang.org/operators.html#Operator-OverloadingAnd there's even a proposal to add it to the C++ standard: http://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3871.ht... And the C standard: http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1312.pdf
Glad it might get into C++ standard.
Funny thing, I worked on a project with a mainframe division, that replaced a crusty old COBOL-based mainframe app with... an RPG mainframe app. In the 2010s. Ostensibly because we could leverage existing knowledge from other divisions under the same parent company, but really because of politics, as these things normally are.
Plus, for all of COBOL's faults, it's simply more efficient for "business-y" processes. All anyone cares about is manipulating data found within a file or database, and that's what COBOL excels at.
It's so efficient that it's hard to grok at first. And 'normal' COBOL sytnax works. And it comes with a web framework. If anyone on HN is sitting on an aging COBOL project/app you could do worse than to chat to Zortec in Tennessee.
price PIC 999V99
...
move 3.14 to price
would result in the WebAssembly equivalent of price = 314
In other words: Use fixed-point arithmetic, but with base-10 instead of base-2.