<div dir="ltr">I&#39;m developing an application where we use RxSwift heavily. RxSwift is a stream library. Consequently, closures that we pass to its combinators often live infinitely (this is because one can use RxSwift to represent infinitely long sequences in time). <div><br></div><div>Closures with infinite lifespan have implications for the question &quot;what is the best reference capture mode for closures&quot;. My experience is that in RxSwift applications, the current default (strong) is almost always suboptimal. It leads to difficult-to-detect memory leaks and introduces a &quot;gotcha&quot; factor to programmers who are new to Swift. I&#39;d prefer the default to be weak capture.<div><br></div><div>So, I&#39;d like to ask you two things:</div><div><br></div><div>A) By default, why the Swift closure captures values strongly?</div><div>B) Should we add a compiler option that, when turned on, would emit a warning if a closure strongly captures a class instance?</div><div><br></div><div>Regards</div><div>Lauri</div></div></div>