I know that in many cases bumping an "old" thread is frowned upon - however, in this case my thinking is that this thread should be considered "old" after Swift 6 is released, because in the meantime having a single thread with all of these ideas collected could be better than arbitrarily fracturing it in to many threads... if you think otherwise feel free to let me know and I'm sorry to bother.
Anyway, what I want to add to the list of ideas for breaking changes in Swift 6 is something fairly minor that I hadn't ever paid any attention to until a couple days ago when I thought about it, investigated it, posted about it, and got some interesting information that led me to believe that it would(might) be a good idea to make this change.
The change is this:
Currently, the initial value that is assigned to a static variable is lazily evaluated upon the property being accessed for the first time, even if that first access is merely the act of assigning a new value.
I'm proposing that we could consider changing the final part, such that the whole thing reads "the initial value that is assigned to a static variable is lazily evaluated upon the property being accessed for the first time, except that if the first access is to set a value then the initial value is only evaluated if the property has a didSet
that explicitly references oldValue
."
See the post for slightly more detail.