Swift Concurrency Provides Compile-Time Feedback for Runtime Behavior
If you struggle with Swift 6 and Swift Concurrency (and who doesn’t), this may brighten your mood a bit: Matt Massicotte published a proper introduction.
My personal highlight is this:
[W]e can just play around with our types, their APIs and structure, and the compiler will give us feedback about their concurrent behaviors. You can often get considerable amounts of work done without even needing to run the code! That gives you a really fast feedback loop.
The ability to iterate on a design’s runtime behavior this way is cool.
I believe I, too, felt this effect when playing around with actor isolation. But Matt really nailed expressing what this means.
It’s compiler feedback for implicit assumptions we made in the past. We don’t need to test parts of concurrent behavior if we learn to wield this tool.
Well, this is the vision.
The reality in the past year(s) and the current discussion is dominated by expressing frustrations because it’s hard to understand. It would’ve been hard before, too, but now we can’t gloss over things like NSImage
being inherently async when passing actor boundaries anymore because the compiler won’t let us. And some first party API’s aren’t even properly or fully ported to Swift concurrency support, yet. And documentation is sparse.
But I do share Matt’s excitement that vision and reality will eventually conflate, and we’ll be better off then.