News for hackers. Stuff that matters.
Re:AI migrated legacy COBOL programs to Java, bugs included by edflsafoiewq on Monday August 03, 2026 @05:10AM (#49153157)
You can't use BigDecimal either. There are libraries whose whole purpose is just to exactly reproduce COBOL arithmetic, eg. the IBM Decimal Arithmetic Library.
Re:AI migrated legacy COBOL programs to Java, bugs included by ptx on Monday August 03, 2026 @06:08AM (#49153656)
Wow, their Java code example [0] makes COBOL look elegant and terse by comparison.

[0] https://community.ibm.com/community/user/blogs/gregory-cerne...

Re:AI migrated legacy COBOL programs to Java, bugs included by DarkUranium on Monday August 03, 2026 @06:40AM (#49153916)
I know it's not the only problem (but it is IMO the main one), but this is why I'm a proponent of allowing operator overloading in languages.

Yes, you can't tell at a glance if `+` really still does what it should, but I find that problem no different from a library mis-naming a function and/or said function having strange side-effects.

`+` should do addition, period. No, not even concatenation if possible (I do find the lack of a separate concatenation operator to be a language flaw --- that said, I understand the use of `+` for concat in libraries targeting languages that offer no alternative).

I think the abuse (especially in C++ ... seriously, allowing overloading of the comma operator? --- and <iostream> working via bit-shifting streams by ${some_string} bits) gave everyone a bad taste and they kind of threw out the baby with the bathwater.

Re:AI migrated legacy COBOL programs to Java, bugs included by Oxodao on Monday August 03, 2026 @08:10AM (#49154695)
php has a separate `.` operator that concatenate and you get an error if you try to do it with a `+`. That's indeed better but most of the time you concatenate with `sprintf` anyway
Re:AI migrated legacy COBOL programs to Java, bugs included by DarkUranium on Tuesday August 04, 2026 @07:23AM (#49167035)
Yes, and it's a surprising good part about PHP (a language that otherwise has an enormous collection of warts, to put it mildly).

I feel like the more dynamic and/or weakly-typed the language is, the more important it is to have a separate concat operator.

The worst ones being weakly-typed and dynamic. Consider `'5' + '10'` in JavaScript vs `'5' - '10'`. I also very much dislike Python's `+` for concat, but at least it's more strongly typed.

PHP, Lua, and Erlang are three examples of dynamically-typed languages with separate concat operators (`.`, `..`, `++`; respectively), and they all are better for it.

That said, even statically-typed languages benefit greatly from it. Maybe if C++ had a concat operator, it'd never end up abusing `<<` for writing to a stream (yes, there's no opposite for reading, but maybe they wouldn't end up doing that in this case).

For example, D uses `~` in infix for concat. Even UnrealScript, a 1990s game-engine-specific language (which tend to be a mess in general) did this right (it uses `$` or `@` --- with `a @ b` being equivalent to `a $ " " $ b`, IIRC).

Re:AI migrated legacy COBOL programs to Java, bugs included by vips7L on Monday August 03, 2026 @01:08PM (#49158578)
It seems like Java is thinking about it now that Valhalla is landing and they’re expecting more user defined mathematical types.