[swift-users] Implicitly capture a mutating self

David Sweeris davesweeris at mac.com
Fri Dec 16 17:57:47 CST 2016


> On Dec 16, 2016, at 15:54, Richard Wei via swift-users <swift-users at swift.org> wrote:
> 
> Thanks. That’s true, but there are cases (like making BLAS calls) where I have to nest more than 4 `withUnsafeMutable…` closures. It’s safe by really clumsy. I just wish there were a cleaner way that looks like the do-notation in Haskell or for-notation in Scala.

You might be able to do something with wrapper functions or operators. As long as you tell the compiler to always inline them, I don't think that'd cause any performance issues.

- Dave Sweeris


More information about the swift-users mailing list