A Look Into the Future by Roman Elizarov
Why Stack Overflow recommends it
Stack Overflow users link it as the primary source for upcoming Kotlin features, such as explicit backing fields and coroutine interoperation with Project Loom.
Recommended by 0 people across 0 different months, 2020 to 2024.
What it is
A JetBrains conference talk by Kotlin language lead Roman Elizarov covering the history of Kotlin, its short-term roadmap, and speculation on future features. It draws on what the Kotlin community wants and which features may or may not land in the language.
What people said
Cites Adam A · 2020-10 · Stack Overflow · on “How Kotlin coroutines will use Project Loom?”
As Roman Elizarov outlined in his talk [this video] there will be interoperation with Project Loom. As for the need for coroutines, you have to realize that Kotlin is a multiplatform language which means that coroutines have to work on all platforms, including the browser and native code. Even if they will use Project Loom on the JVM the API has to stay consistent, since the same code will be compiled to all platforms.
Cites Tenfour04 · 2021-04 · Stack Overflow · on “Kotlin - An Elegant Way to Expose a Mutable List as an Immutable List”
Edit: The feature originally described below has evolved into the explicit backing fields feature, which is currently prototyped in the K2 compiler. With explicit backing fields [LINK] , the syntax would be: val items: List<String> field = mutableListOf() Original answer: No, but they have something in the works that might appear in a future version of Kotlin. The suggested syntax would look something like this: private val items: MutableList<String> = mutableListOf() public get(): List<String> This was presented by the language design lead in a talk about possible future features of Kotlin. [this video] To be a bit pedantic, you are exposing a read-only List, not an immutable one.
Cites Vivek Modi · 2024-05 · Stack Overflow · on “Explicit backing field not working in latest kotlin 2.0.0 android”
I am using Kotlin 2.0.0. I was trying in my current android project. I was trying from this video [this video] . class MainActivity : ComponentActivity() { val state: StateFlow<Int> field = MutableStateFlow(0) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { AndroidTheme { SignInScreenRoute() } } } } It giving me error Explicit backing field declarations are not supported in FE 1.0 libs.versions.toml [versions] androidGradlePlugin = "8.4.1" kotlin = "2.0.0" coreKtx = "1.13.1" junit = "4.13.2" junitVersion = "1.1.5" espressoCore = "3.5.1" lifecycleRuntimeKtx = "2.8.0" activityCompose = "1.9.0" composeBom = "2024.05.00" navigationCompose = "2.7.7"