What about adding a contract to delegated properti...
# language-evolution
h
What about adding a contract to delegated properties, which allows smartcast with the provided value by ensuring to always provide the same value? Use case: kotlinx-cli parser or Compose State. Both libraries ensure the provided value is stable and does not change.
Copy code
val parser = ArgParser("ejwrapper")
val jobID by parser.option(ArgType.String)
parser.parse(args) // No changes to jobID after parsing

if (jobID != null) {
    val status = getJobStatus(jobID) // smart cast is not possible because jobID has a open or custom getter
Current workaround is
!!
, another variable or
let
e
I haven't seen proposals like that before, but perhaps it could tie into Roman's last comment in https://youtrack.jetbrains.com/issue/KT-28413
h
Regarding synchronization? I created the ticket https://youtrack.jetbrains.com/issue/KT-53894