Some basic facts that lead me to this question:
Is it therefore possible to write Kotlin code in a Grails application?
I've worked quite a bit with Grails 2.x, and recently at a new job I have been working with Kotlin, Spring, and Struts. I really like the null-safety and type inference features of Kotlin, and the functional programming features of Kotlin feel much more natural and easy to use than in Groovy (this last part is pure opinion).
Is it possible to use Grails to handle things like:
but use Kotlin to write the actual logic of the domain classes, controller actions, services, object factories, etc.
Probably not likely, because I'm guessing that some of the core functionality of Grails is made possible by dynamic typing, but maybe it could be possible through either a Gradle plugin or a direct Grails plugin.
I like the extreme simplicity provided by the convention-over-configuration paradigm of Grails, but I much prefer the static typing and type inference of Kotlin.
If I could write business logic in Kotlin in a Grails environment, that, to me, would be the ultimate web application framework!
Is it therefore possible to write Kotlin code in a Grails application?
Definitely. You can use any JVM language from a Grails app. I built a proof of concept with Kotlin in Grails and everything worked just as one would hope: https://github.com/jeffbrown/langdemo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With