Skip to content

Conversation

stephencelis
Copy link
Member

The current signatures were the result of fighting language changes in real time, and while it mostly worked in a non-default main actor world, I think this is more correct.

@_inheritActorContext _ apply: @escaping @isolated(any) @Sendable () -> Void
) -> ObserveToken {
observe(isolation: isolation) { _ in apply() }
observe { _ in Result(catching: apply).get() }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a trick similarly employed by the Observations type to convert an @isolated(any) to a synchronous function. I'm not sure if there is a more legit way to assume the isolation of a closure to perform it synchronously.

@stephencelis stephencelis merged commit 923d507 into main Sep 10, 2025
5 checks passed
@stephencelis stephencelis deleted the isolated-any branch September 10, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants