Factory breaking change under consideration.... #112
Replies: 2 comments 9 replies
-
Interest issue you are discussing. In my view, I don't think this approach is the most correct. I was reviewing the Factory code to better understand the bug involving strict-concurrency, and there are two points that can serve as a starting point to address this warning. The first one is that "shared" should be a "let" property. The second point is that the Factory needs a PR that implements conformance to Sendable. Even though the code is thread-safe due to the use of locks, Swift is not able to know that at compile time without the use of Sendable. I believe that by making these improvements and using a constant for "shared," we will have a solution to this warning. What do you think? |
Beta Was this translation helpful? Give feedback.
-
Ummm... just tried that and it eliminated the majority of the warnings. My biggest problem with that approach was in the fact that for testing and whatnot your couldn't "reset" a shared factory by simply assigning a new one to it. Those doing so, however, could switch those to simply use a reset... // Instead of...
Container.shared = Container()
// Do...
Container.shared.reset() Will noodle some more... |
Beta Was this translation helpful? Give feedback.
-
Issue #111 describes new warnings that can occur when Swift strict-concurrency is set to complete in your project.
On consideration of the various ramifications, I may need to consider a breaking change to Factory to do this properly. The current definition of SharedContainer is...
But I may need to change that to...
With access to the static shared container managed by access functions. From the outside and in most cases it looks the same...
With the only issue occurring if people define their own container types.
Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions