HACKER Q&A
📣 4ipp

Functional programming in Kotlin vs. Scala advantages/disadvantages?


I am curious if there are any advantages or disadvantages in the are of functional programming comparing Scala and Kotlin. Are there any important functional features that one has and the other doesn't?


  👤 osdev Accepted Answer ✓
I think the main differences Scala being much more of a functional programming language where as Kotlin is a bit of a balance between Java/OOP and FP and affects the complexity/learning curve of the respective languages.

OVERVIEW - Scala is much more of a functional programming language - Scala has a steeper learning curve - Scala community/ecosystem leans much more towards FP - Kotlin is like Functional Programming "lite"

LANGUAGE - Scala: has higher kinded types - Scala: has for comprehensions - Scala: has type classes - Scala: has built in support for monads - Scala: has better support for encoding errors at compile time

MARKET - Kotlin: has heavy usage on Android - Kotlin: on the server side is pretty active too - Kotlin: integrates nicely with java - Kotlin: multi-platform support


👤 sidcool
Scala is a much more functional language than Kotlin. Scala has inbuilt support for constructs like monads etc. Kotlin needs library like Arrow.

👤 ldjkfkdsjnv
Big thing with scala is you really need someone who knows what theyre doing. The language is powerful and complex, which allows developers to shoot themselves in the foot. A big project, with all first time scala developers, will turn into somewhat of a maintenance nightmare. Generally at the outset, it needs to be determined what the best practices and design patterns will be.

👤 tharne
If you're looking to stay in the world of JVM and want something functional, enjoyable, and a little different, check out Clojure.