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

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
// 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.

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


/// 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 force-pushed the zwaldowski/conditional-task branch from 3a855e2 to b8622b3 Compare September 19, 2018 02:29
@zwaldowski zwaldowski force-pushed the zwaldowski/conditional-task branch from b8622b3 to 3b25cb2 Compare September 19, 2018 02:34
@zwaldowski zwaldowski force-pushed the zwaldowski/conditional-task branch from 3b25cb2 to d8beda2 Compare September 19, 2018 02:38
@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.

2 participants