3 ms·
Wow, their Java code example [0] makes COBOL look elegant and terse by comparison. [0] https://community.ibm.com/community/user/blogs/gregory-cernera/2026/04/0
by ptx 2mo ago
Wow, their Java code example [0] makes COBOL look elegant and terse by comparison.
[0] https://community.ibm.com/community/user/blogs/gregory-cernera/2026/04/07/ibm-decimal-arithmetic-library-for-java-v20-releas https://community.ibm.com/community/user/blogs/gregory-cerne...
- DarkUranium 2mo agoI 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.
- Oxodao 2mo agophp 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
- DarkUranium 2mo agoYes, 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).
- vips7L 2mo agoIt seems like Java is thinking about it now that Valhalla is landing and they’re expecting more user defined mathematical types.