openwhisk-runtime-java
openwhisk-runtime-java copied to clipboard
Add support for Kotlin actions
Long time ago I came up with instructions on how to run Kotlin on the java runtime in OpenWhisk. Maybe we should add that stuff here?
See: https://github.com/markusthoemmes/openwhisk-kotlin
We already started work on Kotlin runtime, work under construction once is stable IBM will contribute to Apache OpenWhisk https://github.com/ibm-functions/runtime-kotlin
Hmm, any reason why we'd build a specific Kotlin runtime vs. just using the Java one?
I think the reason is that java actions don't need kotlin standard library and so to keep the java runtime and java action jar minimal a dedicated runtime (with kotlin-specific stuff bundled) is considered.
There's really two reasons for having a specific Kotlin runtime:
-
Platform and dependencies As @mkouba says, it means that we can embed the Kotlin standard library into the runtime and remove the need to include it in the action. It also means that in the future we have the option to switch to kotlin-native in the future if it makes sense to.
-
Programming model and customisations It makes it much easer to customise for Kotlin and adopt a more idiomatic programming model. For example, experimental Kotlin runtime does simple things like append the "Kt" to the class name for you. The experimental runtime also adds a data class based API so that you can avoid having to work with JSON directly. The next step would be to look more at how to implement a Kotlin idiomatic async API.
The experimental runtime also adds a data class based API so that you can avoid having to work with JSON directly.
This is also possible in Java, using e.g. Gson. Of course, java does not data data classes and so it's much more verbose.
This should imho be definitely added to java runtime too.
Kotlin idiomatic async API
Makes sense.