News for hackers. Stuff that matters.
Re:Java 20 Is Out! by pshirshov on Tuesday March 21, 2023 @11:35AM (#35247699)
> structured concurrency

That's another huge effort which delivered us an imperfect abstraction.

I would prefer to have HKTs and typeclasses, so I may implement my own IO monad.

Re:Java 20 Is Out! by quectophoton on Tuesday March 21, 2023 @11:52AM (#35247951)
> I would prefer to have HKTs and typeclasses, so I may implement my own IO monad.

I'm not a Java developer, and I haven't even read about higher kinded types or typeclasses (the theory side of programming is my weakness); but you picked my curiosity with this.

Can you elaborate how concurrency done this way would look in Java?

Re:Java 20 Is Out! by pshirshov on Tuesday March 21, 2023 @12:00PM (#35248085)
Re:Java 20 Is Out! by bluetech on Tuesday March 21, 2023 @12:25PM (#35248469)
Some discussion on zio in loom-dev mailing list recently: https://mail.openjdk.org/pipermail/loom-dev/2023-March/00535...
Re:Java 20 Is Out! by pshirshov on Tuesday March 21, 2023 @12:35PM (#35248651)
Loom is useful as an underlying mechanism for an IO monad. What I mean is that Java as language still lacks important features so they have to deliver half-baked things like that "structured concurrency". From my point of view these new abstractions are evil - the better ones were out there for a while.
Re:Java 20 Is Out! by ackfoobar on Tuesday March 21, 2023 @12:57PM (#35249014)
Other than STM, what is special? Almost everything there has an equivalent in traditional imperative programming.
Re:Java 20 Is Out! by pshirshov on Tuesday March 21, 2023 @03:09PM (#35251004)
More contracts enforced by the typer.

> Almost everything there

Everything. But the mere presence of "equivalents" doesn't make pure functional programming less valuable.

Re:Java 20 Is Out! by ackfoobar on Tuesday March 21, 2023 @03:15PM (#35251096)
I have used cats-effect but not ZIO.

My view has been that reinventing imperative programming (IO monad) on math (pure FP) on imperative programming (the machine) brings me no benefit.

Re:Java 20 Is Out! by pshirshov on Wednesday March 22, 2023 @05:55AM (#35258845)
> What does a coarse-grained effect type get you?

For monofunctors: reliable error handling, an ability to re-interpret the same IO structure multiple times, better reasoning during refactorings due to referential transparency.

For bifunctors: the above plus explicit domain (expected) error encoding and even more reliable error handling.