06/06/2018, 9:16 AM
Hi all, probably it was already answered, but I wasn't able to find any discussion about it. So my question relies on smart casts of class properties. As we know, smart cast of mutable property of nullable type isn't possible (
Smart cast to Type is impossible because propertyName is a mutable property that could have been changed by this time
. It relies on fact, that between checking for null and call to property value could have been changed by another thread. Proposed solution is to bake reference in a local variable and operate with it. It is great that developers of languages thought about situation of shared states between two threads, but it's really awkward to see this message in a program which operates in main thread only. Having to bake all properties seems really redundant in this scenario. So my question is: is there any plan to introduce some way to mark property as thread safe? At least some annotation which will turn off this check?


06/06/2018, 3:06 PM
Mutable properties can change after the check not only because of the multi-threading. See this forum discussion for details: and the issue followed that discussion