News for hackers. Stuff that matters.
Re:Java 23: The New Features Are Officially Announced by pjmlp on Wednesday April 17, 2024 @07:31AM (#40063096)
Contrary to what vocal Kotlin advocates might believe, Kotlin only matters on Android, and that is thanks to Google pushing it no matter what.

https://spectrum.ieee.org/the-top-programming-languages-2023

https://snyk.io/reports/jvm-ecosystem-report-2021/

And even so, they had to conceed Android and Kotlin on their own, without the Java ecosystem aren't really much useful, thus ART is now updatable via Play Store, and currently supports OpenJDK 17 LTS on Android 12 and later devices.

As for your question regarding numbers, mostly Java 74.6%, C++ 13.7%, on the OpenJDK, other JVM implementations differ, e.g. GraalVM is mostly Java 91.8%, C 3.6%.

https://github.com/openjdk/jdk

https://github.com/oracle/graal

Two examples from many others, https://en.wikipedia.org/wiki/List_of_Java_virtual_machines

Re:Java 23: The New Features Are Officially Announced by pzo on Wednesday April 17, 2024 @07:45AM (#40063213)
Any reason Kotlin is not being adopted outside android? I haven't used Java for like a decade - is it that Java improved well enough to kotlin not being competitive anymore? E.g. Spring Boot seems to have kotlin support. Kotlin 2.0 compiler seems also around the corner, same with jetbrains-compose.
Re:Java 23: The New Features Are Officially Announced by beeboobaa3 on Wednesday April 17, 2024 @08:32AM (#40063737)
Compilation is slow as balls and there's only 1 viable ide. You're going to have to spend extra time onboarding Java developers and it just doesnt add enough to be worth it
Re:Java 23: The New Features Are Officially Announced by jiehong on Wednesday April 17, 2024 @08:04AM (#40063404)
First of all, I think many projects just waited before dipping their toes in kotlin.

Now that java itself is adding many functionalities inspired from other languages, it's much less appealing.

I saw some backend projects at $company, and after 2 or 3 years, the decision was made to only use java on new files, and convert kotlin files to java when they are touched. Why? The kotlin compiler was so much slower that it was noticeable, while javac is still very fast. Another reason is available talent not related to Android. Lastly, its value proposition wasn't high enough to justify a different language, especially with java 17 and later.

That being said, even quarkus provides kotlin apis nowadays, so it's not like it doesn't happen.

Re:Java 23: The New Features Are Officially Announced by vbezhenar on Wednesday April 17, 2024 @08:08AM (#40063459)
Java is good enough and Kotlin does not add anything substantial worth of switching.

Google provides first-class support for Kotlin. Oracle does not. Kotlin does not evolve with JVM. For example they introduced coroutines to imitate blocking code and few years later Java decided to create green threads, making the feature essentially obsolete.

Kotlin made sense in Java 1.7 time, when Java seemed to be stale and kind of dead. Things changed since then.

Re:Java 23: The New Features Are Officially Announced by jpgvm on Wednesday April 17, 2024 @07:50AM (#40063271)
Kotlin is growing in usage. Not as fast on backend obviously because Java is still perfectly serviceable but it's still definitely growing.

The area Kotlin excels in isn't as a pure Java replacement to be used by Java devs but rather a JVM language palatable to the Python/Javascript/Ruby/Golang crowd. It's very very hard to convince such people that they should even try Java but Kotlin is much easier to at least get them to try and show them it's really not hard at all.

Re:Java 23: The New Features Are Officially Announced by pjmlp on Wednesday April 17, 2024 @08:02AM (#40063388)
The Python/Javascript/Ruby crowd has JVM implementations to look for.
Re:Java 23: The New Features Are Officially Announced by galdosdi on Wednesday April 17, 2024 @08:50AM (#40063895)
Had.

One of the most egregious destructions of great value in the modern world wasn't the collapse of the Key Bridge or the destruction of the library of Alexandria -- it was when Jython, a wonderful implementation of Python2 on the JVM, died because it was too much effort to upgrade it to support Python3. So much value and capital, destroyed because of the damn 2to3 fiasco. ALL FOR WHAT? For goddamned PRINT STATEMENTS?

Now all the libraries have moved on, so Jython is not so useful -- you can do toystuff but you can't import any serious modern python library anymore, which you could a decade ago! And you got real multithreading with no GIL to worry about it! It was ahead of the real CPython2!

It was more than just a way to integrate and glue together Java and Python code -- it was actually a viable alternative Python runtime. It's a big reason I've never forgiven or started retrusting the python community after the 2to3 fiasco. It just shows it's not a serious language like java that actually cares about backwards compatibility and is able to advance anyway.

Hey, what ever happened to Groovy? It was like Scala/Kotlin but without taking itself seriously at all, much more akin to perl than to C++.

Re:Java 23: The New Features Are Officially Announced by pzo on Wednesday April 17, 2024 @10:25AM (#40065086)
Did Jython even ever supported all non pure python libraries? The biggest moat of cpython is huge ecosystem of native libraries such as numpy, scipy, scikit, pillow, pandas, opencv, pytorch, tensorflow etc. This is the reason why PyPy is not mainstream. Without all those libraries and ecosystem around it python wouldn't be that useful and for the same reason Jython wouldn't be that useful even if supporting python3 and having the fastest JVM.
Re:Java 23: The New Features Are Officially Announced by chuckadams on Wednesday April 17, 2024 @11:12AM (#40065831)
Groovy is still around in projects that haven't yet moved their gradle configs to Kotlin (which includes a declarative syntax basically identical to Groovy builders). Purely dynamic-typed languages are a hard sell these days, especially when they're as pokey and memory-hungry as Groovy.
Re:Java 23: The New Features Are Officially Announced by gbear605 on Wednesday April 17, 2024 @09:06AM (#40064037)
Check out GraalPy! It’s like Jython but it’s on Python 3 and supported by Oracle. My company is still using Jython, but we’re finally tearing out our Jython implementation and replacing it with GraalPy since it’s much more performant and it’s going to stay up to date with Python development.
Re:Java 23: The New Features Are Officially Announced by galdosdi on Wednesday April 17, 2024 @09:43AM (#40064468)
Whaaaa? I will definitely check it out next time I have a use case. Thanks. How compatible is it?
Re:Java 23: The New Features Are Officially Announced by sigsev_251 on Wednesday April 17, 2024 @10:27AM (#40065124)
There is a compatibilty chart: https://www.graalvm.org/python/compatibility/
Re:Java 23: The New Features Are Officially Announced by kaba0 on Wednesday April 17, 2024 @10:41AM (#40065344)
It can even run some C-wrapper python libs, as it can run LLVM code.
Re:Java 23: The New Features Are Officially Announced by weatherlight on Wednesday April 17, 2024 @08:02AM (#40063385)
Simply inertia. Java is what people know and hire for unfortunately.
Re:Java 23: The New Features Are Officially Announced by matsemann on Wednesday April 17, 2024 @07:49AM (#40063258)
When I was a consultant, what I saw was that almost all new code in java codebases at multiple projects/clients was entirely Kotlin. No idea what the person you're replying to is on about.
Re:Java 23: The New Features Are Officially Announced by pjmlp on Wednesday April 17, 2024 @08:01AM (#40063381)
Congratulations, you are part of the 18% Kotlin on JVM and 10% language relevance numbers from the reports I shared.
Re:Java 23: The New Features Are Officially Announced by dtech on Wednesday April 17, 2024 @08:44AM (#40063840)
18% is way too large to just dismiss it as "irrelevant"
Re:Java 23: The New Features Are Officially Announced by matsemann on Wednesday April 17, 2024 @09:05AM (#40064030)
Being one in six java developers isn't worthy of a congratulations I think, but thanks anyways. But it does show how wrong your statement was about Kotlin only being an Android thing.
Re:Java 23: The New Features Are Officially Announced by pjmlp on Wednesday April 17, 2024 @10:01AM (#40064750)
It is, because most teams using Kotlin on JVM are Android shops writing server side code.

There are other reports to dive into.

Re:Java 23: The New Features Are Officially Announced by matsemann on Wednesday April 17, 2024 @10:27AM (#40065121)
I disagree. I've never been in an "Android shop", and still seen plenty of Kotlin code (all the places I mentioned mainly had React Native apps). You have some preconceptions that probably aren't correct, and try to make all reports fit that narrative. Just accept that lots of people use Kotlin without having anything to do with Android.
Re:Java 23: The New Features Are Officially Announced by pjmlp on Wednesday April 17, 2024 @04:42PM (#40069856)
Like all guest languages on the JVM, its domain outside godfathers' mobile Kingdom won't move the needle to rewrite the Java ecosystem.
Re:Java 23: The New Features Are Officially Announced by somehnguy on Wednesday April 17, 2024 @09:51AM (#40064595)
This is also the case at my (large) company. We have a lot of Java code around, but anything new is Kotlin. The teams pretty universally strongly prefer it.
Re:Java 23: The New Features Are Officially Announced by ldjkfkdsjnv on Wednesday April 17, 2024 @08:06AM (#40063430)
Java pulls in the best language features from kotlin and scala, which reduces the edge of using those languages
Re:Java 23: The New Features Are Officially Announced by hocuspocus on Wednesday April 17, 2024 @09:02AM (#40064015)
This is an overly simplistic take.

Java hasn't taken that much from Kotlin really, sometimes even gone in a completely opposite direction (for instance with Loom).

Java has taken a few things from Scala but I would hardly call them the best features. Java will never adopt what truly makes Scala stand out, on purpose.

Re:Java 23: The New Features Are Officially Announced by matsemann on Wednesday April 17, 2024 @09:07AM (#40064049)
While java has evolved a lot, I still find it hard to go back. The stream syntax and similar things will never match how easy it is to do proper functional programming in Kotlin. I do miss real pattern matching, though.
Re:Java 23: The New Features Are Officially Announced by yafetn on Wednesday April 17, 2024 @08:43AM (#40063834)
I think the Jetbrains team are dropping the ball when it comes to Kotlin on the JVM. They seem to be focusing their energy on KMP, and I’m not sure they have the capacity to deal with all the platforms they want to target (Kotlin/JS, Kotlin/Native, Kotlin/JVM, KMP, Jetpack Compose (?) etc). That being said, I’d strongly encourage others to try Kotlin as a Java alternative for server-side applications (Spring Boot integration is really nice, for instance). It’s such a delight to use! And it’s still my favorite language. Some features I especially like:

- context receivers (think of them as implicit parameters that are checked at compile-time)

- null safety. This is a BIG one, especially if you’re coming from Java.

- structured concurrency. Java still doesn’t have this. Note that SC is different from what was introduced in Project Loom.

- immutable variables, data classes, value classes etc.

Re:Java 23: The New Features Are Officially Announced by derriz on Wednesday April 17, 2024 @11:57AM (#40066485)
I switched back recently (from Kotlin to Java). I'm not 100% happy with the switch. Despite new Java features, it comes nowhere near providing Kotlin's terseness. But a few of the reasons that made me try this switch include being uncomfortable with the closed and proprietary nature of the Kotlin's evolution and that the only IDE support available is via a product owned by the same company. I know Oracle "owns" Java but it feels different - they have no incentive to limit the marketplace for developer tools and IDEs.

I also prefer a smaller languages - and I feel earlier versions of Kotlin were beautifully balanced in this regard with a small(ish) number of powerful and orthogonal improvements over Java. The language has grown significantly since then at a far faster rate than Java - maybe approaching C# velocity.

Finally, and I realise that a lot of effort has gone into addressing the issue in recent releases but compile times were much worse for me than equivalent Java.

Re:Java 23: The New Features Are Officially Announced by Starlevel004 on Wednesday April 17, 2024 @04:20PM (#40069637)
Kotlin has stagnated for the last few years (!) due to JB dropping everything to rewrite the entire compiler (twice).

In the meantime, Java took a lot of the good features and made them even better, e.g. Java has actual pattern matching and Kotlin doesn't.

Re:Java 23: The New Features Are Officially Announced by misja111 on Wednesday April 17, 2024 @08:16AM (#40063545)
> that is thanks to Google pushing it no matter what.

No, it's because Android is stuck on Java 8, so if you want any language progress you need to look further to something that can run on top of it.

Re:Java 23: The New Features Are Officially Announced by _ZeD_ on Wednesday April 17, 2024 @08:27AM (#40063687)
basically that's the same thing...
Re:Java 23: The New Features Are Officially Announced by pjmlp on Wednesday April 17, 2024 @08:31AM (#40063726)
You missed the part where I mentioned that despite the original "Move everyone into Kotlin" agenda, they were forced to backpedal on that strategy and now Android supports Java 17.
Re:Java 23: The New Features Are Officially Announced by cies on Wednesday April 17, 2024 @01:18PM (#40067579)
Kotlin is amazing on the backend. Lot's of successful startups do it. Larger shops are adopting it. SpringBoot is (albeit not as big as Google) also fully on the Kotlin bandwagon. Ktor is there for the purists.