Kotlin

From APIDesign

(Difference between revisions)
Jump to: navigation, search
Current revision (06:03, 10 September 2025) (edit) (undo)
 
Line 1: Line 1:
-
[[wikipedia:Kotlin_(programming_language)|Kotlin]] is the [[Java]] 2.0 people were always asking for. However it comes with own glitches:
+
[[wikipedia:Kotlin_(programming_language)|Kotlin]] is the [[Java]] 2.0 people were always asking for.
 +
 
 +
== Improvements ==
 +
 
 +
=== Extension Methods ===
 +
 
 +
{{:ExtensionMethods}}
 +
 
 +
 
 +
== Drawbacks ==
 +
 
 +
However [[Kotlin]] also comes with own glitches.
Try to debug annotation processors in [[Gradle]] (which is the default build tool for [[Android]]) and '''Kapt''' isn't easy. One has to:
Try to debug annotation processors in [[Gradle]] (which is the default build tool for [[Android]]) and '''Kapt''' isn't easy. One has to:

Current revision

Kotlin is the Java 2.0 people were always asking for.

Contents

Improvements

Extension Methods

A way to extend RootClass (or any other class) with functionality without disturbing others. Way better than DefaultMethods. Used in Kotlin. And also in Enso.

The basic idea is to avoid extending RootClass physically, but rather extend it virtually via a lexical compilation scope.

See wikipedia:Extension_method explanation which may agree or contradict my view.


Drawbacks

However Kotlin also comes with own glitches.

Try to debug annotation processors in Gradle (which is the default build tool for Android) and Kapt isn't easy. One has to:

./gradlew --no-daemon clean build -Dkotlin.daemon.jvm.options="-Xdebug,-Xrunjdwp:transport=dt_socket\,address=5006\,server=n\,suspend=n"

I wish it was as easy as debugging the Maven in NetBeans as explained in Use the Debugger. Stupid article! Here is the page that helped, at the end.

Forget Kotlin, use (modern) Java!

Personal tools
buy