News for hackers. Stuff that matters.
Re:Java 21 Released by kaba0 on Tuesday September 19, 2023 @11:37AM (#37571469)
This property is not really part of the type system though.

Also, as mentioned by another commenter below - is a file exists operation async? Sync? Why, why not?

Re:Java 21 Released by wiseowise on Tuesday September 19, 2023 @11:51AM (#37571747)
What if file exists operation MUST be sync?
Re:Java 21 Released by kaba0 on Tuesday September 19, 2023 @11:57AM (#37571855)
Then you don’t start it in a virtual thread. Your calls automatically become blocking or not blocking depending on your callsites, which is the proper place to decide that.
Re:Java 21 Released by wiseowise on Tuesday September 19, 2023 @11:59AM (#37571880)
So it still has colors?
Re:Java 21 Released by lolinder on Tuesday September 19, 2023 @11:56AM (#37571828)
In TypeScript at least, async-ness is encoded in the type system, because async/await is just syntactic sugar for Promise/then/catch.
Re:Java 21 Released by kaba0 on Tuesday September 19, 2023 @12:42PM (#37572565)
Well, JS is paired with a single-threaded execution model, so you only have concurrency to worry about. C#, Java has proper multithreading as well, that gives another dimension to the problem.
Re:Java 21 Released by lolinder on Tuesday September 19, 2023 @01:27PM (#37573231)
Kotlin has multithreading, and it also puts `suspend` in the type system.
Re:Java 21 Released by n2d4 on Tuesday September 19, 2023 @02:56PM (#37574590)
Some more examples: Rust, Python (with most/all? type checkers), C# all bake this into their type systems.
Re:Java 21 Released by vips7L on Tuesday September 19, 2023 @05:02PM (#37576589)
This is more due to the fact that Kotlin doesn’t control its backend and is designed to work with a language that already includes this model, js.
Re:Java 21 Released by samus on Tuesday September 19, 2023 @08:26PM (#37578946)
Very simple - in Java, almost any IO operation in blocking. Exceptions are the stuff in the NIO package, thread interruption and signalling, and maybe process termination.