News for hackers. Stuff that matters.
Re:(On | No) Syntactic Support for Error Handling by karmakaze on Tuesday June 03, 2025 @03:19PM (#44173600)
At least Java supports covariance and contravariance where Go only supports invariant generics.
Re:(On | No) Syntactic Support for Error Handling by PaulHoule on Tuesday June 03, 2025 @03:49PM (#44173936)
Java has evolved to contain much of “ML the good parts” such as that languages like Kotlin or Scala that offer a chance to be just a bit better in the JVM look less necessary
Re:(On | No) Syntactic Support for Error Handling by throwaway2037 on Tuesday June 03, 2025 @11:43PM (#44177025)

    > Java has evolved to contain much of “ML the good parts”
Can you give some examples?
Re:(On | No) Syntactic Support for Error Handling by yz453 on Wednesday June 04, 2025 @12:50AM (#44177328)
Not OP. IMO the recent Java changes, including pattern matching (especially when using along with sealed interface), virtual threads (and structured concurrency on the way), string templates, are all very solid additions to the language.

Using these new features one can write very expressive modern code while still being interoperable with the Java 8 dependency someone at their company wrote 20 years ago.

Re:(On | No) Syntactic Support for Error Handling by tpm on Wednesday June 04, 2025 @04:35AM (#44178503)
fyi: string templates were just a preview and removed in Java 23
Re:(On | No) Syntactic Support for Error Handling by PaulHoule on Wednesday June 04, 2025 @09:57AM (#44180799)
For Java systems that I work on for my own account there is a lot of stuffing things like SQL queries into resource files so that I don't have to mess around with quotes and such.
Re:(On | No) Syntactic Support for Error Handling by PaulHoule on Wednesday June 04, 2025 @09:56AM (#44180791)
Like a lot of other languages, Java has gotten a big dose of

https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_sy...

To defy it's reputation for verbosity, Java's lambda syntax is both terse and highly flexible. Sum and product types are possible with records and sealed classes. Pattern matching.

Re:(On | No) Syntactic Support for Error Handling by karmakaze on Tuesday June 10, 2025 @05:20PM (#44241576)
I even found a way to make ad-hoc union types of element types from other packages that does exhaustive switch/case checking. I quickly wrote down a PoC so I wouldn't forget[0]. It needs wrapper types and sealed interfaces in the consuming app/package but is manageable and turned out better than other attempts I'd made.

[0] https://github.com/karmakaze/AdHocUnion