News for hackers. Stuff that matters.
Re:Java Feature Spotlight: Text Blocks by MaxBarraclough on Friday May 01, 2020 @10:43AM (#23042452)
> There's a mature library for every concept in existence

If you'll forgive a light trolling: how about ahead-of-time compilation, allocating small objects on the stack, UTF-8, compile-time asserts, or SIMD support?

(Was going to include await/async, but then I remembered EA Async.)

I realise this is a little off topic, but the JVM isn't without limitations. (Or perhaps all my examples are wrong - disproof welcome!)

Re:Java Feature Spotlight: Text Blocks by pron on Friday May 01, 2020 @12:01PM (#23043402)
AOT: GraalVM Native Image (https://www.graalvm.org/docs/reference-manual/native-image/), Project Leyden: https://mail.openjdk.java.net/pipermail/discuss/2020-April/0...

SIMD: https://openjdk.java.net/jeps/338 (to be merged soon), plus, of course, auto vectorisation, which is already in.

Allocating small objects on the stack: this already happens automatically through escape analysis, but more generally (and more importantly) arrays-of-structs: http://cr.openjdk.java.net/~briangoetz/valhalla/sov/01-backg...

UTF-8: What do you mean? Java has supported UTF-8 for a loooong long time. Even the source files support Unicode with UTF-8 encoding.

compile-time asserts: Not sure what you mean. But there's a rich compile-time plugin mechanism: https://www.baeldung.com/java-annotation-processing-builder and even pluggable type systems: https://checkerframework.org/manual/

Async/await: how about lightweight threads, instead? https://wiki.openjdk.java.net/display/loom/

Re:Java Feature Spotlight: Text Blocks by doteka on Friday May 01, 2020 @10:57AM (#23042580)
You can get AOT compilation with GraalVM today, allocating small objects on the stack is being worked on in Project Valhalla, compile time asserts can be implemented with annotations if you care (see @NotNull), utf-8 is available in the standard library in the StandardCharsets class.

For Async/await, I believe a much better approach is available with Quasar today or with Project Loom soon.

SIMD is an issue though if you need that.

Re:Java Feature Spotlight: Text Blocks by apta on Friday May 01, 2020 @11:18AM (#23042828)
SIMD is being worked on as well: https://openjdk.java.net/jeps/338

See Project Panama for the encompassing project: https://openjdk.java.net/projects/panama/

Re:Java Feature Spotlight: Text Blocks by vips7L on Friday May 01, 2020 @11:28AM (#23042973)
AOT was available for over a DECADE with the GNU Compiler for Java before it was removed.
Re:Java Feature Spotlight: Text Blocks by MaxBarraclough on Friday May 01, 2020 @01:09PM (#23044198)
It's also long been possible with lesser-known proprietary solutions like Excelsior JET, so I suppose Java can claim to have a mature solution to that feature, just not a mature mainstream FOSS solution (not counting Graal).
Re:Java Feature Spotlight: Text Blocks by nickbauman on Friday May 01, 2020 @10:55AM (#23042564)
The JVM world has Graal for AoT, FWIW. I would argue that await/async is really settling for the mediocre still. Many languages, even JVM languages offer more powerful abstractions and concepts for solving that problem. Clojure's implementation comes to mind.
Re:Java Feature Spotlight: Text Blocks by bpicolo on Friday May 01, 2020 @10:46AM (#23042475)
Yeah, I'm thinking higher level, for sure, rather than limitations of the language - fair to call out.

You can specify UTF-8 as the default charset (unless you mean for identifiers?) and Grall does exist for AOT.

Re:Java Feature Spotlight: Text Blocks by MaxBarraclough on Friday May 01, 2020 @04:20PM (#23046093)
I thought Java's String was hard-coded to UTF-16. Is that mistaken?