Jared Sinclair

@jaredsinclair
682 Followers
235 Following
754 Posts

developer n’ designer • I make @moxtopper • also ’Sodes also many (cr)apps that never shipped • Oldsmobile man. • former nurse • bad writer • Cleve Land

“Silence, exile, and cunning.”

Homehttps://jaredsinclair.com
GitHubhttps://github.com/jaredsinclair
Twitteraych tee tee pee ess colon slash slash fuck dot off dot com slash &then=die
MTG Life Trackerhttps://moxtopper.com

@mattiem A reviewer noted that calling `cancel()` on SomeScreenSomewhere did not propagate downward and cause the checked continuation to throw the cancellation. Result: "Cancel" button appeared to be inert.

BTW, this pseudocode would be closer to a reality once your typed-throws on Tasks proposal gets approved. There's a lot of unfortunate do/catch and ?? in the real implementation.

@mattiem Runs the gamut. There are literally 700+ places in our codebase where an unstructured Task is initialized. Some of them are just drive-by tasks where cancellation doesn't matter, but others are `let task = Task {...}` dances that are part of complex user-driven work flows (two-factor authentication, f.ex.) where cancellation can come from below or from above and needs to propagate throughout multiple sub-workflows.
@mattiem Thanks for the chat. I've opened a PR (my first) at swiftlang/swift to improve the documentation https://github.com/swiftlang/swift/pull/85861 - The source code documentation is misleading on this topic, whereas the programming book is not.
Improve Task documentation. by jaredsinclair · Pull Request #85861 · swiftlang/swift

Explanation Clarifies that Task instances do not inherit cancellation from an enclosing Task within which they are created. Clarifies that the term "child task" does not refer to such tas...

GitHub
@mattiem Would you be available to chat sometime (for 20~30mins) about what I think is a major concurrency bug in Swift? I think child task cancellation is broken. Perhaps sometime this week or next? I need a second pair of eyes before I'm sure. It'd be easier over a screenshare. My email is desk at jaredsinclair dot com If not... no worries at all.
@matthew Aww, thanks.
@jasongregori You can. It doesn't require AnyCancellable, just a class with a `private let task: Task<...>` property will do the trick. Override `deinit` to add `task.cancel()`. And inside `init`, where you create your task, just wrap the Observations sequence and implement correct weak referencing in exactly one place and encourage your teammates to use this wrapper instead of Observations directly.
@lensco 😭
@rdsquared Thanks, I'll correct it.
@auramagi Is it alright if I link to your Mastodon profile in a follow-up blog post? This is worth a follow-up, quite a change from Combine+Published.
@auramagi YIKES