What is in Kotlin that is not in Groovy?


#1

What are the futures that Kotlin have that Groovy do not?


#2

Kotlin has:

  • data classes
  • sealed classes
  • extension methods (which are easier to write and use)
  • non-nullable types
  • cleaner standard library, with classic names for FP constructs (like map instead of collect)
  • Kotlin is newer, it didn’t implement closures as a class groovy.lang.Closure, and because of that integrates better with java 8 than groovy does

groovy has:

  • AST transformations
  • @Delegate AST (which is way better than in kotlin)
  • categories
  • standard library has templating
  • standard library has ConfigSlurper and ConfigObject, which are nicer to use than java.util.properties

#3

Groovy also has type checking extensions.

See: http://docs.groovy-lang.org/next/html/documentation/type-checking-extensions.html

These can be used to provide type checking support for AST transformations, or to make type checking stricter in some spots.