Dependency-propagating Schedulers #85
                  
                    
                      kabiroberai
                    
                  
                
                  started this conversation in
                Ideas
              
            Replies: 1 comment 2 replies
-
| 
         @kabiroberai swift-dependencies depends on combine-schedulers and swift-clocks, and not the other way around, so I'm not sure it's really possible for us to propagate dependencies automatically without combining these libraries. Your   | 
  
Beta Was this translation helpful? Give feedback.
                  
                    2 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Update: There's now a PR for this: see #86.
Scheduler APIs currently fail to propagate dependencies across the
scheduleboundary:If swift-dependencies didn't claim to support schedulers at all this would maybe be acceptable, but there's even a
mainQueuedependency so it's extra strange that using it doesn't propagate deps. Plus, it'd be nice if we eased the transition from Combine to Concurrency by somewhat supporting Dependencies in the latter.One approach to solve this is to add a
dependenciesmodifier toScheduler, similar toanimation/transaction:Under the hood this would wrap the
schedulecalls inwithEscapedDependenciesto propagate the continuation.We could also make all built-in CombineSchedulers (e.g.
UIScheduler) forward dependencies by default, or at least do so for themainQueuedependency. Would be happy to put up a PR to 1) addScheduler.dependenciesand 2) forward dependencies onmainQueue— curious to hear other people's thoughts.Beta Was this translation helpful? Give feedback.
All reactions