Kotlin

Impressions

  • I was quite discouraged by how verbose the language can be, etc. Not great for Godot.

  • Didn't impress me, but seemed solid.

  • I like having 'first-class functions'.

About

  • Kotlin in 1 minute .

  • Kotlin for C# developers .

  • Kotlin for TypeScript developers .

  • Designed to replace Java, due to much easier-to-read syntax.

  • Default access control:  Public.

    • Although the global default is public , Kotlin uses private  for members defined within nested or local classes  when no visibility is specified.

    class MyClass {
        private class PrivateClass { } // Private by default
    }
    
Compatibility
  • Multiplatform:

    • Widely used for Android development.

  • Java:

    • Compatible with Java, as the compiled code becomes Java.

  • JavaScript:

    • "Can also be compiled to JavaScript, Native LLVM, and any JVM, making it suitable for building web applications."

Syntax

fun main() {
    var hello = 'hi mom'
    println(hello)
}
  • Has static typing.

  • The language uses camelCase for its functions.

    • :/ annoying.

  • Uses var  to declare variables (mutable variable).

  • Uses val  to declare constants (immutable variable).

  • Has automatic type inference, so both of these are equivalent:

    var hello = 'hi mom'
    var hello: String = 'hi mom'
    
  • Has 'null safety', using ?  to allow the type to be null.

    var hello: String? = 'hi mom'
    
    • Makes hello  nullable.

  • The use of ;  is optional.

  • Functions are 'first class objects', which is very good.

    • Can create lambdas, pass as parameters, etc.

Game Dev

Godot Kotlin

Old
  • Kotlin Native Binding for Godot .

    • Only for Godot 3.2.

    • This state will not change in the near foreseeable future. The Kotlin Native performance is not where it needs to be to make this binding efficient. Currently, the build times are incredibly slow due to the lack of incremental build support in Kotlin Native. Also, the runtime performance is much slower than GDScript in many cases.