Re: [swift-users] Re-initializing lazy vars

2017-10-20 Thread Rick Mann via swift-users
It just seems so obvious to create-if-nil, and makes it nice to reset stuff that should be re-created. In my case, after my NSURLSession gets invalidated, I wanted to set the property to nil, and next time a session was needed, it would just get created. Sure, I can implement this myself, but u

Re: [swift-users] Re-initializing lazy vars

2017-10-20 Thread Jordan Rose via swift-users
It's not directly related to property behaviors. It was a bug that only worked with ImplicitlyUnwrappedOptional properties; we patched the type checker bug that led to it being allowed and didn't even notice until someone brought it up (SR-5172 ). It would

[swift-users] Swift 4 Strings and flatMap

2017-10-20 Thread Santiago Gil via swift-users
Hi Swift users, I just ran into a bug after a Swift 4 migration where we expected [String] and got [Character] from a flatMap since flatMap will flatten the String since it's now a collection. While I understand why flatMap behaves this way now that string are collections, in testing this I found