Skip to content

[Concurrency] Simplify the type story for Continuation by eliminating Throwing variants #35868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 12, 2021

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Feb 10, 2021

The goal of doing this is to reduce the amount of boilerplate and repeated code w.r.t. Continuation. Having just added resume() in four places, I got the sense that there was a lot of common code that was being duplicated. D.R.Y.

This change resolves rdar://74154769.

@grynspan grynspan changed the title [Concurrency] Simplify the type story for Continuation by eliminating… [Concurrency] Simplify the type story for Continuation by eliminating Throwing variants Feb 10, 2021
@grynspan
Copy link
Contributor Author

A previous iteration of this code included a Continuation protocol that owned, in particular, default implementations of resume(with:) and resume(). The core team decided against implementing a protocol here.

@grynspan
Copy link
Contributor Author

@swift-ci Please smoke test

@grynspan
Copy link
Contributor Author

@swift-ci Please smoke test

1 similar comment
@grynspan
Copy link
Contributor Author

@swift-ci Please smoke test

@grynspan
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 151336445fac986a1d88a34882aba752985ca056

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 151336445fac986a1d88a34882aba752985ca056

… Throwing variants

The goal of doing this is to reduce the amount of boilerplate and repeated code w.r.t. Continuation. Having just added `resume()` in four places, I got the sense that there was a lot of common code that was being duplicated. I removed the Throwing variants of these types (they can be expressed as Continuation<T, E:Error> instead of ThrowingContinuation<E>) and I broke out a significant amount of common code between CheckedContinuation and UnsafeContinuation into an implementation-only protocol to avoid repeating it. D.R.Y.

This change resolves rdar://74154769.
@grynspan
Copy link
Contributor Author

Squashed changes.

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - d8f7f20

@grynspan
Copy link
Contributor Author

@swift-ci Please clean test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - d8f7f20

@grynspan
Copy link
Contributor Author

@swift-ci please test macOS

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - d8f7f20

@grynspan grynspan requested a review from jckarter February 11, 2021 17:56
@grynspan
Copy link
Contributor Author

@swift-ci please clean test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7e72154

@grynspan
Copy link
Contributor Author

@swift-ci please clean test

Copy link
Contributor

@jckarter jckarter left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@grynspan grynspan merged commit 36b03a4 into swiftlang:main Feb 12, 2021
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.

3 participants