Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Move Task functionality into conditional conformances #253

Merged
merged 6 commits into from
Sep 19, 2018

Conversation

zwaldowski
Copy link
Contributor

@zwaldowski zwaldowski commented Sep 17, 2018

What's in this pull request?

Working towards #224.

Extracts extension Task and extension FutureProtocol where BlahBlahBlah into extension TaskProtocol. It resolves the major ergonomic issues with Task methods, allowing you to call the map, andThen, etc. you're expecting to on Future<TaskResult<T>> without wrapping it as Task. Beyond that, the idea is to reduce complexity in the API and to reduce the occurrence of compiler errors from not extending the right thing.

Testing

None intended.

API Changes

Many, but they should be source-compatible.

@zwaldowski zwaldowski added the wip label Sep 17, 2018
@@ -6,10 +6,10 @@
// Copyright © 2015-2018 Big Nerd Ranch. Licensed under MIT.
//

import Dispatch
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rewrite this out.

@@ -201,13 +201,12 @@ extension Progress {
let progress = Progress(totalUnitCount: 0)
progress.completedUnitCount = 1
progress.isCancellable = false
progress.isPausable = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove this, not related to this PR

return progress
}

/// A simple indeterminate progress with a cancellation function.
static func wrappingCompletion<OtherFuture: FutureProtocol>(of base: OtherFuture, cancellation: (() -> Void)?) -> Progress {
let totalUnitCount: Int64 = base.wait(until: .now()) != nil ? 0 : -1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Split this out, not related to this PR

@zwaldowski zwaldowski removed the wip label Sep 19, 2018
@zwaldowski zwaldowski merged commit 9cd3223 into master Sep 19, 2018
@zwaldowski zwaldowski deleted the zwaldowski/conditional-task branch September 19, 2018 06:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant