-
Notifications
You must be signed in to change notification settings - Fork 20
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
Feature - Prepping 3.1.0 Release #6
Conversation
/// The binding type of a parameter to bind to a statement. | ||
public typealias BindingType = Data | ||
|
||
extension CodableBinding where BindingType == Data { |
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 is the change worth calling out. The Swift 4.1 compiler throws a warning now when defining the typealias in the protocol or the protocol extension. And rightfully so, because it can lead to all sorts of odd behavior when redefining the typealias
in conforming types or subclasses.
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.
Read the thread and SR and the change seems like the right thing to do, but to make sure I'm grokking this... with the new syntax, this extension is only available when the BindingType
type is Data
, correct?
How does this break existing users of the code?
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.
Great question. The only place this would break an existing user is if you had created a CodableBinding
type such as a Person
struct that you wanted to write directly into the database as a data blob. We actually have these in the test suite.
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.
Ah, makes sense. I'd suggest #1 as the version strategy. While this does require changes to the callers code, it's more of a slight language shift caused by Swift 4.1 than a "we actually changed the API" thing. This doesn't feel like a major version change to me.
@@ -17,6 +17,8 @@ class BindingTestCase: BaseTestCase { | |||
// MARK: - Helper Types | |||
|
|||
private struct Person: CodableBinding, Equatable { | |||
typealias BindingType = Data |
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.
Here's an example @AtomicCat of the change clients would be required to make on Swift 4.1.
This PR updates SQift to Xcode 9.3 and and fixes any compiler warnings from Swift 4.1. The change worth calling out here is the removal of the
CodableBinding
protocol extension explicitly setting theBindingType
associated type toData
in a typealias. The Swift 4.1 compiler now complains that you shouldn't do that and should instead define the protocol extension with a generic constraint. See this Swift forum thread and SR-7324 for more info.I'm a bit torn as to how we should release this change. The options I see are:
Let's openly discuss these options in this PR to iron out the best way to release Swift 4.1 and Xcode 9.3 support.