Kotlin update previews experimental features
Kotlin 1.5.30, just published by JetBrains, offers experimental new language features and experimental additions to the standard library. The experimental features include sealed when statements and instantiation of annotation classes, which could become official in the upcoming Kotlin 1.6.0 release.Sealed when statements, if enabled, introduce a compiler warning if a when statement is not exhaustive. This is intended to make code safer without developers needing to introduce their own functions. [ Also on InfoWorld: What to expect in Java 18 ] Also being previewed is support for suspend functions as supertypes, enabling the use of suspend functional types as super interfaces, although there are limitations, such as developers not being able to use multiple suspend functional supertypes. This has been considered a missing piece in Kotlin coroutines design.To read this article in full, please click here
Kotlin 1.5.30, just published by JetBrains, offers experimental new language features and experimental additions to the standard library. The experimental features include sealed when
statements and instantiation of annotation classes, which could become official in the upcoming Kotlin 1.6.0 release.
Sealed when
statements, if enabled, introduce a compiler warning if a when
statement is not exhaustive. This is intended to make code safer without developers needing to introduce their own functions.
Also being previewed is support for suspend
functions as supertypes, enabling the use of suspend
functional types as super interfaces, although there are limitations, such as developers not being able to use multiple suspend
functional supertypes. This has been considered a missing piece in Kotlin coroutines design.