09:20
09:36
"create another task in task using Task.init or Task.detached. - Yeah but why would one do that " - sometime you do not have any other choice, however, this should be really last choice, because when you do so, you leave the world of structured concurrency.
2 hours later…
11:20
I guess the most important thing for me from this thread as you've outlined a few times is that a task being a child of another (that is achieved by async let or taskGroup) is a different concept from what the documentation says about Task - "the task created by Task.init(priority:operation:) inherits the priority and actor context of the caller".
When we talk about structured concurrency we talk about a tree of tasks. When we talk about creating a new task with init we talk about inheriting actor context.
The fact that a task created with .init inherits the actor context of the caller DOES NOT and WILL NOT mean that the task is a child of 'some-up-the-stack' potential parent task.
I have read a few books and numerous articles and I can see there is this cloud of confusion everywhere on how things work and how we should be using them. WWDC is super vague, the proposals are very detailed with theory that a normal user has difficult time processing it.
We hear everywhere about task trees and so on but then Task created with init inside another task is not a child of its parent? Task created with async let (that the user has no notion of) however is a child of its parent - Its very confusing and in my opinion the Swift team has made redundant syntax sugars which are cool to show off in WWDC but are hard to understand when you start working with them
« first day last day (15 days later) »