-
Notifications
You must be signed in to change notification settings - Fork 229
Closed
Labels
nnbdNNBD related issuesNNBD related issues
Description
As proposed, the only way to query the state of a late initialized variable to see if it has been written would be to try to read it, and catch the resulting error. We explicitly discourage catching errors, so this seems non-ideal. Should we provide this functionality? And if so, how do we expose it?
For comparison, Kotlin provides a way to do this via reflection.
If we do provide this, then what is the right behavior for it on late int x = 3 + 3? Is this variable considered initialized before the first read/write (since it has an initializer)? Or is it considered uninitialized since the initializer has not yet been run (and may in principle never complete with a value and cause the variable to actually be initialized)?
sumanthratna and GZGavinZhao
Metadata
Metadata
Assignees
Labels
nnbdNNBD related issuesNNBD related issues