Re:New language features since Java 8 to 17
by pooya72 on Sunday October 24, 2021 @01:24PM
(#28980021)
By multiline strings are you referring to text blocks? Those have been added to the language in Java 15: https://docs.oracle.com/en/java/javase/15/text-blocks/index.... .
Re:New language features since Java 8 to 17
by atomicnumber3 on Sunday October 24, 2021 @02:06PM
(#28980420)
Oh, sorry, I know, I mentioned it specifically because it was "only" just added in Java 15 (which is basically "now" in Java timescales heh, and has only literally just now (with 17) made it into LTS AdoptOpenJDK releases, which also haven't quite landed on many distros package repositories, etc etc.). So for some weird value of "right now" Java still doesn't quite have multi line strings due to its newness.
Re:New language features since Java 8 to 17
by EdwardDiego on Sunday October 24, 2021 @10:14PM
(#28983852)
Tbh I still crave Kotlins inline string interpolation.
Re:New language features since Java 8 to 17
by kaba0 on Monday October 25, 2021 @03:34AM
(#28985303)
A “superior” implementation is in the works with templated strings.
It will look something like this:
STR.”text with \\{variable}”, but anything implementing the TemplatedString interface can change the behavior of interpolation. There is not even a requirement to produce strings only!
Re:New language features since Java 8 to 17
by EdwardDiego on Monday October 25, 2021 @04:22AM
(#28985590)
Oh nice, do you have a link to the project?
Re:New language features since Java 8 to 17
by EdwardDiego on Monday October 25, 2021 @05:43AM
(#28985993)
Cheers!
Personally, I think one of my favorite things about Java is that, all things considered, it's a small-ish language. So I'm glad that Java is both willing to evolve (slowly, letting other people try stuff out first) but also clearly focused on a curated feature set and resistant to letting new stuff in to bloat it. I am very happy to deal with minor things like no multiline string support if it means we get to avoid being a terrible mess of language features that ruby, scala, python, etc have accrued in a relatively quicker timescale.
I was fairly sad around the java 6-7 days where we went quite a long time with no visibly major new language features (diamond inference was 7's big thing, lol). So it is nice that we're moving a bit faster than that, now.