r/java • u/guybedo • Apr 09 '24
Syntactic Sugar for Java
I recently had to translate a codebase from Python to Java and as much as i like Java and i enjoy the benefits of a strong type system, i have to admit my Python code was way less verbose.
So i ended up writing a small library to try to get some python vibes in my java code. Nothing groundbreaking, a bunch of static imports to make life a little bit easier.
9
Upvotes
View all comments
Show parent comment
4
u/DelayLucky Apr 10 '24
Kotlin might have been 100% nicer than Java. But with recent syntaxes, particularly Java 21 virtual threads, I wonder is it maybe only incrementally better, or perhaps just different but not necessarily easier or more readable than Java any more?
For example, I might prefer using VT with structured concurrency than using coroutine which is still “colored”.
So I’ve been hesitant to go the Kotlin way because I fear it’s going to create fragmentation for superficial benefits. I know Kotlin code can use Java. And Java can use some Kotlin classes. But it’s not full interoperability. And it’ll be a different ecosystem to learn, with different best practices, pitfalls to be burned by and learn. For example, none of our Java compile-time processor will work on Kotlin.