-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to Kotlin? Feedback from Android and Kotlin devs appreciated... #9
Comments
Kotlin is great for apps. However, using it to implement a foundational and language-agnostic library such as UncleJim is problematic:
Due to 3., I wouldn't be able to use UncleJim if it was written in Kotlin. I hope the Java 8 version is here to stay. PS: Dexx is a persistent collections library that offers a Kotlin add-on to improve Kotlin interoperability. Nevertheless, the core module is written in pure Java, likely for reasons similar to those I outlined above. |
Thanks for this. You make good points. You touched on the question of where UncleJim is headed. "Writing Java the way I'd write Clojure, but with types" has been a primary motivation. The next logical step is to make a language that uses these collections as the built-in data-types (like JSON in JavaScript or the built-in data types in Clojure). UncleJim would stay in Java for maximum interop between Java and the new language. I think Java 8, with lambdas and default methods on interfaces is the biggest step forward since Java 5 with generics. I needed Java 8's improvements to get this put together in a reasonable amount of time. I don't know what the future holds, and I may make a branch for Java 9, or maybe some day for Kotlin. Either way, I'm not planning to do away with the Java 8 version so long as it's still supported by Oracle. I figure for the Android developers, they'll have Java 8 at some point too, so there's just this short-term gap to cross. |
Perhaps in a few years when Android Nougat has a market share of 75 % or more. Before Android Nougat, only lambdas are supported, but not default methods. Porting to Kotlin would be very appreciated. I don't think users would need to have a Kotlin compiler installed, the IDE plugin would only be needed to view library sources properly. Otherwise, UncleJim would be seen as a regular JAR without sources. Still, a solution using Java 6 at its core + a Java 8 and Kotlin frontend would work as well. If you need any help with Kotlin, maybe I can lend a hand. |
One extra point in favour of Kotlin is that they are going to provide soon a way to compile the same code to different targets, like Java 6 (default) or Java 8 (with native lambdas & default methods in interfaces). Plus with Kotlin it's possible to explicitly inline functions, which would probably make for some performance improvements and even more code re-use. |
Thanks everyone who added their input. Version 4.0 looks like a rewrite in Kotlin. Not sure yet if this project will eventually merge with https://github.com/kategory/kategory but that's a possibility. If you're using Kotlin and Java now, you may want to try version 3.1 in the KotlinFootWetting branch to avoid namespace collision with the Mutable collections. In the 4.0 branch, we're implementing the Kotlin interfaces, so it won't be an issue. If you're all Java, stick with 3.0 as the name changes in 3.1 will probably be reverted in 4.0. |
Instead of converting UncleJim to Java 7 or Java 6, we could convert the whole thing to Kotlin and compile it to Java 6 from there.
"Kotlin generates bytecode which is compatible with Java 6 or newer. This ensures that Kotlin can be used in environments such as Android, where Java 6 is the latest supported version."
I started my new project at work this week using Kotlin. I've only used it for 2 days, but so far it looks amazing! They have shaved off all the backwards-compatibility warts of Java (like primitives and arrays) and added a few of the safer parts of Scala. About the only syntax I really even had to look up was the lambda syntax which is different from either Java or Scala, but certainly no worse.
One alternative for Android developers is a back-port to Java 6 or 7, but that's going to be pretty difficult due to the default methods in interfaces. What if we convert the whole thing to Kotlin and compile it to Java 6 from there? Or maybe Android developers would rather use Kotlin?
Does Kotlin require a runtime library on Android? If so, how big is it? Other considerations? If you work in Android and/or Kotlin or have any relevant experience, your feedback would be appreciated.
The text was updated successfully, but these errors were encountered: