Skip to content
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

Reduce the responsibility of ResultProtocol. #235

Merged
merged 2 commits into from
Jun 9, 2017

Conversation

andersio
Copy link
Contributor

@andersio andersio commented May 29, 2017

Similar to signal and producer operators in ReactiveSwift, method and computed properties are now moved to the concrete type. ResultProtocol now requires only a ResultProtocol.result requirement which materializes self.

Caveat: Automatic migration is impossible, but manual migration is not hard (copy & pasting .result).

@@ -1,14 +1,14 @@
// Copyright (c) 2015 Rob Rix. All rights reserved.

/// An enum representing either a failure with an explanatory error, or a success with a result value.
public enum Result<T, Error: Swift.Error>: ResultProtocol, CustomStringConvertible, CustomDebugStringConvertible {
case success(T)
public enum Result<Value, Error: Swift.Error>: ResultProtocol, CustomStringConvertible, CustomDebugStringConvertible {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a separate, breaking change. We should probably do this separately?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're all for this change, so I'm okay with just doing it here.

@@ -1,34 +1,14 @@
// Copyright (c) 2015 Rob Rix. All rights reserved.

/// A type that can represent either failure with an error or success with a result value.
// A protocol that can be used to constrain associated types as `Result`.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have 3 /s so it shows up in Xcode's documentation viewer.

Copy link
Member

Choose a reason for hiding this comment

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

@mdiep mdiep requested a review from ikesyo May 31, 2017 20:29
@mdiep
Copy link
Contributor

mdiep commented May 31, 2017

I'd definitely love to have @ikesyo review this. He has a much better understanding of the consequences of this than I do.

Copy link
Member

@ikesyo ikesyo left a comment

Choose a reason for hiding this comment

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

I'm for @mdiep's comments, but otherwise LGTM 👀

@ikesyo ikesyo requested a review from mdiep June 9, 2017 20:20
@mdiep mdiep merged commit 6081af7 into antitypical:master Jun 9, 2017
@mdiep
Copy link
Contributor

mdiep commented Jun 9, 2017

🤘

@andersio andersio deleted the remove-result-protocol branch June 9, 2017 20:51
@ikesyo ikesyo mentioned this pull request Apr 26, 2018
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