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
Pitch: Deprecate ActionProtocol #248
Conversation
Although I just realised something: given that 3.1 is supposed to be source-compatible with 3.0, I think we should be able to just slap the deprecation warning on and not duplicate anything?? I'll take a look at how to get Swift 3.1 to compile in 3.0 mode... |
I've just pushed a change which removes the duplication. |
I now believe this should work just fine for our other |
Because the deprecation warning only shows for Swift >= 3.1, this could now go into a patch release. |
Not sure what to do about the podspec error. I guess we should |
Interesting, I didn't see that warning in my tests. I'll try with a different Xcode version and see if it comes up (I was using the 8.3 beta). |
|
This is not source compatible since the definition has changed. Even if it is kept intact, the real problem is that we cannot do this with Another issue would be the deprecation warnings in our codebases that cannot be suppressed, should we still have any extensions to these deprecated entities. |
Yeah, we don't have to keep the incompatible changes, this should probably just be the deprecation. As the implementations have no longer moved, I'm not sure I see why we can't do this with the other protocols? |
2e32503
to
0c9a5ef
Compare
If it is just marking it |
I also just realised that it's not going to be possible to remove So, the current state of this PR:
It's a shame that there's no way to suppress the deprecation warnings for uses internal to ReactiveSwift, and they're a little annoying. But I don't think I mind that for the sake of users. @ReactiveCocoa/reactiveswift I'd love to hear your thoughts on the matter of warnings internal to this codebase. It doesn't bother me, but I totally understand if others feel differently. |
I don't mind internal deprecation warnings—so long as the next major release isn't far off. If we really feel this is a pain, we could do it right before the last 1.x release. |
I think recursive constraint is not relevant here, but parameterized extensions. |
Maybe both? This definitely fails under Swift 3.1 with a recursive constraint error: // Flatten.swift
extension Signal where Value == Signal ... |
Hmm, perhaps. By the way, I have a branch with producer operators converted, e.g. extension SignalProducer where Value: _SignalProducerProtocol, Error == Value.Error { But it got hit by an issue in overloading somehow specific to concrete type extensions, and it so far affects Bug Report: https://bugs.swift.org/browse/SR-3873 |
Swift 3.1 now raises an error when using a private variable from an inlined function.
0c9a5ef
to
cdc3d25
Compare
@@ -207,6 +207,7 @@ private struct ActionState { | |||
} | |||
|
|||
/// A protocol used to constraint `Action` initializers. | |||
@available(swift, deprecated: 3.1, message: "This protocol is no longer necessary and will be removed in a future version of ReactiveSwift. Use Action directly instead.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it cannot be suppressed anyway, we may deprecate it for 3.0.x too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure: currently it only generates a warning inside ReactiveSwift, so I like the idea that it won't generate any warnings for consumers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would happen when building through Carthage in Swift 3.1 anyway... https://travis-ci.org/ReactiveCocoa/ReactiveSwift/jobs/201869272#L821
Yeah, I feel like that's better than introducing deprecation warnings into consuming projects unnecessarily.
… On Feb 15, 2017, at 1:30 PM, Anders Ha ***@***.***> wrote:
@andersio commented on this pull request.
In Sources/Action.swift <#248>:
> @@ -207,6 +207,7 @@ private struct ActionState {
}
/// A protocol used to constraint `Action` initializers.
***@***.***(swift, deprecated: 3.1, message: "This protocol is no longer necessary and will be removed in a future version of ReactiveSwift. Use Action directly instead.")
This would happen when building through Carthage. https://travis-ci.org/ReactiveCocoa/ReactiveSwift/jobs/201869272#L821 <https://travis-ci.org/ReactiveCocoa/ReactiveSwift/jobs/201869272#L821>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#248>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAJA5m3xaTumCRyRyoREIgcgk9Gx88GAks5rc0RDgaJpZM4L3YjH>.
|
@sharplet Oops, it still appears in the build log. |
Tried |
...instead of removing it completely. See the discussion on #245 for context. I'm proposing this change as an alternative for discussion: there are some issues with this approach, so I thought it would be good to have something concrete to discuss.
Benefits:
ActionProtocol
is an implementation detail, but isn't clearly documented as such. There are possibly users making use of it in ways we didn't intend (I was once one of them).Update: See #248 (comment).
Downsides:- Because conditionally compiled code has to be syntactically valid, we essentially have to duplicate the extension. I experimented with using an internal typealias to work around this limitation, but it was unfortunately a dead-end.
I don't have much of a problem with the amount of duplication in this case. But it's pretty clear to me that this approach won't scale all that well to
SignalProtocol
andSignalProducerProtocol
, whose extensions currently house all of the operator definitions. There would be a lot of duplication. There are certainly techniques we could use to avoid duplicating the implementations (reducing the duplication to declarations only), but they might not be pretty.