[swift-evolution] [swift-evolution-announce] [Review] SE-0189: Restrict Cross-module Struct Initializers
blangmuir at apple.com
Fri Nov 17 17:20:19 CST 2017
First off, this is clearly the model we should have had all along ;-) That said, I have a concern about source-compat and our ability to automatically migrate code impacted by this change.
> Source compatibility
> This makes existing code invalid in Swift 5, which is a source compatibility break.
It's not just a source compatibility break, it's a break that cannot necessarily be fixed if you don't control the module that vended the struct. If a library doesn't expose an appropriate initializer, there is no way for the client to invent one. Similarly, this isn't going to be very amenable to automatic migration, since
a) there may not be a memberwise initializer to use
b) even if there is, it may change the semantics to use it
There are two classes that we could theoretically migrate automatically:
1) C structs, since we know the initializer and its semantics
2) when we are migrating the code that defines the struct at the same time
The latter case might be tricky though, since it requires more global knowledge than we have in today's migrator.
Any thoughts? Do we have an idea how common this is or what kinds of places it comes up in most often (in a single codebase with multiple modules vs external dependencies vs C structs vs ....)?
> On Nov 14, 2017, at 11:31 AM, Ted Kremenek <kremenek at apple.com> wrote:
> The review of "SE-0189: Restrict Cross-module Struct Initializers" begins now and runs through November 21, 2017.
> The proposal is available here:
> https://github.com/apple/swift-evolution/blob/master/proposals/0189-restrict-cross-module-struct-initializers.md <https://github.com/apple/swift-evolution/blob/master/proposals/0189-restrict-cross-module-struct-initializers.md>
> Reviews are an important part of the Swift evolution process. All review feedback should be sent to the swift-evolution mailing list at:
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> or, if you would like to keep your feedback private, directly to the review manager.
> When replying, please try to keep the proposal link at the top of the message:
> Proposal link: https://github.com/apple/swift-evolution/blob/master/proposals/0189-restrict-cross-module-struct-initializers.md <https://github.com/apple/swift-evolution/blob/master/proposals/0189-restrict-cross-module-struct-initializers.md>
> Reply text
> Other replies
> What goes into a review of a proposal?
> The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift.
> When reviewing a proposal, here are some questions to consider:
> What is your evaluation of the proposal?
> Is the problem being addressed significant enough to warrant a change to Swift?
> Does this proposal fit well with the feel and direction of Swift?
> If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
> Ted Kremenek
> Review Manager
> swift-evolution-announce mailing list
> swift-evolution-announce at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution