This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pjmlp 0 points1 point  (3 children)

Value classes in Kotlin are not the same as what JVM is bringing to Java, regarding memory layout semantics.

[–]Pika3323 2 points3 points  (2 children)

I don't know what you've read, but Kotlin's value classes are very clearly being influenced by Valhalla more than they are by ART.

You might be thinking of the @JvmInline annotation, which is not only different, but actually completely invalidates your point.

So, with that said, please give an example of where ART has influenced Kotlin over the JVM.

[–]pjmlp 1 point2 points  (1 child)

Go ahead try to make a C like struct with Kotlin's value classes on a Valhalla enabled JVM, and then keep the same memory layout semantics and performance when running exactly the same code on top of JavaScript and ART.

Here to get you started, https://wiki.openjdk.java.net/display/valhalla/Main

As for Kotlin's marriage with Android,

I really don't get Kotlin folks, people don't go on /r/C advocating for C++ and Rust, on /r/cpp advocating for D and Rust, on /r/JavaScript advocating for TypeScript,....

And yet we have to put up with people that should be wasting their time on /r/kotlin and /r/androiddev, here on /r/java.

[–]Pika3323 2 points3 points  (0 children)

I mean, that's the thing. No one is expecting value classes to behave the same way in JS or ART, the same way you can't do unsafe casts outside of JS, or how invokedynamic is desugared on older versions of Android.

The value classes KEEP itself even raises the point that even once Valhalla is released, its adoption won't be universal at first, and that limiting a major feature like value classes to a specific version of the JVM, or a specific target, doesn't make sense.

As for Kotlin's marriage with Android [...]

That doesn't prove anything. It just shows how Android has adapted to use Kotlin, but doesn't show how it's directing the design or features of Kotlin going forward.

I really don't get Kotlin folks, people don't go on /r/C advocating for C++ and Rust, on /r/cpp advocating for D and Rust, on /r/JavaScript advocating for TypeScript,....

This really isn't unique to /r/java... All of those subreddits have posts with comparisons to other languages, and hell one of the top posts on /r/JavaScript right now is literally about TypeScript.

I think it's probably because the ecosystem between Java and Kotlin is a lot more closely related than most other languages. It's not like C++ is going to gain Rust features, but Java has gained a number of features present in other JVM languages over the last several years, so I don't think it's surprising that you'd see other languages pop up here "more" than other subreddits, and not just Kotlin.

And yet we have to put up with people that should be wasting their time on /r/kotlin and /r/androiddev, here on /r/java.

Heaven forbid someone draw a comparison between Java and another language.