@markmalstrom Hard to say for sure because some details there aren’t finalized yet. But I’m pretty sure yes.
I still find this incredibly verbose though…
@markmalstrom I think I want something more like the example at the bottom of this post.
https://forums.swift.org/t/pitch-inherit-isolation-by-default-for-async-functions/74862/119
I'm genuinely surpised to hear these suggestions, because my experiences have been exactly the opposite. I haven't yet encountered a situation where I've wanted some kind of stateless background type. But I have regularly found places where I have this one tiny bit of synchronous work that can be expensive and can and should be done off-actor. JSONDecoder is a fantastic, real-world example. This is the critical concept. I was just imagining what would happen if we made this change without t...
Does this do what you’re wanting? (It wouldn’t have some of the subtler benefits of child tasks, but otherwise I think just adding ‘Task’ and ‘.value’ to that example makes it work.
let result = try await Task {
// this runs on the global executor
try nonIsolatedExpensiveWork()
}.value