Live data from Hacker News

Java 27

mail.openjdk.org

421–423 of 423 posts

Re: Java 27

#421
post #416
post #378

Earlier quoted context omitted.

If the two calls are sequential then simply: var x = someFunction() someOtherFunction() If you would have written var xTask = SomeFunctionAsync(); await WaitForSomeOtherFunctionAsync(); string x = await xTask; then it would be: try (var scope = StructuredTaskScope.open()) { // JDK 24+ preview feature var x = scope.fork(() -> someFunction()); scope.fork(() -> waitForSomeOtherFunction()); scope.join(); String result =…

await implies async functions. Looks like Java's "there is no simpler syntax than plain old synchronous code" is just a lot of extra manual wrangling of stuff

And the first two lines are an async function as they are, without any special handling.

They won't block the thread, and you can have millions of them.

Like it's no accident that c# with their goldfish attention span wanted to ship virtual threads as well next to all their millions of features.

Re: Java 27

#422
post #418

Earlier quoted context omitted.

> You mean it needs 15 lines whete C# needs one? ;) Can you elaborate? The async/await approach is much more than 1 line when you need to switch a call between them. Whereas the green thread approach does not need anything.

What's Java's equivalent of x = await someFunction() await waitForSomeOtherFunction() (both are async)

As mentioned:

var x = someFunction() waitForSomeOtherFunction()

That's semantically equivalent in the two languages.

Re: Java 27

#423

Not a fan of JEP-531, looks the repeat of Optional. Are we really so afraid of extending syntax that we are going to add a class instead of field modifier? private static final Logger log = Logger.getLogger(Whatever.class); This was already verbose enough that Lombok has @Log4j for it, adding `lazy` keyword in front of `final` won't make it any worse.

Do people just not type fast, ignorant of how IDEs work, or what exactly is the deal? I'd rather have the clarity of everything above. It tells me exactly what I need to know and what I can do with it.
Post reply on HN