News for hackers. Stuff that matters.
Re:Welcome to C# 10 by azth on Monday November 08, 2021 @03:20PM (#29153742)
I find Java's features to be very well balanced, and only make it into the language after they've been vetted and tested in the wild by other languages.

e.g. see their take on concurrency by means of project Loom. No need for async/await and providing separate APIs for sync vs async operations. It has records and sealed types and pattern matching, and is getting destructuring soon.

Re:Welcome to C# 10 by pharmakom on Monday November 08, 2021 @04:53PM (#29154741)
I much prefer the Haskell / F# approach of using do-notation to allow the user to build their own syntax.

I don’t think I can build an Async<Either<E, T>> expression with Loom, for example.

Re:Welcome to C# 10 by int_19h on Monday November 08, 2021 @03:59PM (#29154197)
.NET async interops nicely with any other language that can do basic callbacks (even C!). How does that work in Loom?
Re:Welcome to C# 10 by cogman10 on Monday November 08, 2021 @04:17PM (#29154394)
For VM languages no problem, all those languages will support threads or using threads.

For non-VM interopt it will block the carrier thread if a native call causes any sort of blocking.

In Java, external to the VM calls are almost non-existent so it's not much of an issue. Likely you'd do those sorts of calls as regular kernel threads instead of the Loom virtual threads.

Re:Welcome to C# 10 by int_19h on Monday November 08, 2021 @05:38PM (#29155209)
To clarify, by interop here I don't just mean calling foreign functions. I mean calling async foreign functions. When async is explicit, it's easy to handle it on ABI level - it's just a bunch of callbacks (or abstractions wrapping them, like tasks/futures).

For example, suppose you're writing a Windows desktop app, and you decide to do so in Java. Modern Windows APIs are async. How would you asynchronously invoke such an API? In C#, you'd just use await.

Re:Welcome to C# 10 by rvcdbn on Monday November 08, 2021 @04:17PM (#29154392)
Definitely not as easy but Go managed to get it to work fairly well with some extra overhead. I would rather the language design for pure Java first and C interop second.
Re:Welcome to C# 10 by int_19h on Monday November 08, 2021 @05:40PM (#29155227)
This approach results in more closed ecosystems, though, where everything has to be re-implemented to work well, instead of reusing existing libraries (that have been polished for decades in some cases).

Also, what about OS APIs? Those always going to be at the bottom of the stack, and they are increasingly async themselves.