Conversation
| to communicate a deadline to some other system it can use these properties to relay that information | ||
| without needing the deadline to be directly passed. | ||
|
|
||
| #### Behaviors for Cancellation and Expiration |
There was a problem hiding this comment.
I am still working on this section with detailed behavior examples
|
|
||
| //// TODO | ||
|
|
||
| #### Interaction with Executors |
There was a problem hiding this comment.
I will update this once the discussions are finished around what this exactly is and needs to be.
| to communicate a deadline to some other system it can use these properties to relay that information | ||
| without needing the deadline to be directly passed. | ||
|
|
||
| ### Implementation Details |
There was a problem hiding this comment.
Let's not share implementation details in the proposal, we may want to do some efficiency improvements for happy path etc. Including implementation in proposal would potentially tie us down to some unintended bits
There was a problem hiding this comment.
Agree with @ktoso that this level of specificity likely too detailed, but the "behavioral note" part about the cancel-but-wait behavior probably worth emphasizing!
There was a problem hiding this comment.
I think that revealing the implementation details is fine here but I agree that it should claim that implementation is exchangeable with a more streamlined version that interoperates with executors (referenced later in the document under the future directions). Revealing the details gives the reader a point of reference to compare to existing behaviors.
| /// - Throws: A ``DeadlineError`` indicating whether the operation failed before deadline | ||
| /// (``DeadlineError/Cause/operationFailed``) or was cancelled due to deadline expiration | ||
| /// (``DeadlineError/Cause/deadlineExceeded``). | ||
| nonisolated(nonsending) public func withDeadline<Return, Failure: Error>( |
There was a problem hiding this comment.
nitpick, we put access control first in this combo of keywords:
| nonisolated(nonsending) public func withDeadline<Return, Failure: Error>( | |
| public nonisolated(nonsending) func withDeadline<Return, Failure: Error>( |
… constrained to a Instant.Duration == Swift.Duration
| public var cause: Cause | ||
|
|
||
| /// The deadline expiration that was specified for the operation. | ||
| public var expiration: any InstantProtocol |
There was a problem hiding this comment.
We need to guard this out in embedded mode.
This initially started off as a proposal for swift-async-algorithms, however it became very clear that it was a larger audience for potential usage and was decided that it would be better served as an addition to the Concurrency library.
This proposes adding a
withDeadlinefunction to the Concurrency library that allows execution of an asynchronous operation with a composable time limit.