I believe at the moment the Kotlin compiler is mis...
# language-proposals
r
I believe at the moment the Kotlin compiler is missing a single feature to guarantee pure functions to those that care. The Kotlin compiler already is able to track effects with
suspend
and
@RestrictsSuspension
which enables users to encode functions that produce effects with
suspend
. This is awesome and is what we've built Arrow Fx upon. What the Kotlin compiler is currently missing or maybe I failed to find a way is for users to disallow in their code bases function application when functions return
Unit
and they are not inside
suspend
. With such a feature which could be activated via import, scoped annotations or simple compiler flag the Kotlin compiler would be able to a la carte guarantee function purity which is something not even scalac or other inclined FP langs in the JVM provide. This would be opt-in and would not affect anyone that does not care about this feature. What are your thoughts on this potential feature. If there is interest I will submit a KEEP after @tomasruizlopez and @Jorge Castillo submit KEEP-87 this week.
👍 7