[swift-evolution] [Proposal draft] Conditional conformances
dgregor at apple.com
Fri Sep 30 13:23:57 CDT 2016
> On Sep 30, 2016, at 6:25 AM, plx via swift-evolution <swift-evolution at swift.org> wrote:
>> On Sep 28, 2016, at 5:53 PM, Douglas Gregor <dgregor at apple.com <mailto:dgregor at apple.com>> wrote:
>>> On Sep 28, 2016, at 1:28 PM, plx via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> It’s good to see this starting to happen!
>>> Is the decision on "no-overlapping-conformances” something that’s seen-as set in stone permanently, set in stone for the near future, or perhaps at least somewhat open to reconsideration at the present moment?
>> There hasn’t been a decision per se, so it that sense it’s open to reconsideration.
> I see. A related question: if overlapping conditional conformances are disallowed in Swift 4, would e.g. ABI concerns make it infeasible to relax that restriction in future Swift (5, 6, X, etc.)?
It’s hard to be definitive without having a specific design for what overlapping conditional conformances would mean, but I feel fairly confident that we could introduce them later in some form. It would almost certainly involve deployment limitations—one would not be able to dynamically query for an overlapping conformance and have that code run correctly on a Swift 4 runtime—but the general scheme in the ABI should generalize.
>> I have a strong *personal* bias against overlapping conformances, because I feel that the amount of complexity that they introduce into the language and its implementation far outweigh any benefits. Additionally, they enable use cases (e.g., static metaprogramming-ish tricks) that I feel would be actively harmful to the Swift language’s understandability. Generics systems can get very complicated very quickly, so any extension needs to be strongly motivated by use cases to matter to all or most Swift developers.
> This is purely anecdotal but I had a lot of utility code laying around that I’d marked with notes like `// TODO: revisit once conditional conformances are available`.
> When I was leaving those notes I was expecting to need overlapping conformances often, but I reviewed them *before* replying and I actually haven’t found an example where having overlapping conformances is both (1) a significant win and also (2) a win in a way that’d be of broad, general interest.
> - 80% have no real need for overlapping conditional conformances
> - 15% might have “elegance gains” but nothing practically-significant
> - 5% would *probably* see real gains but are likely not of broad interest
> …which wasn’t what I was expecting, but leaves me a lot more comfortable without overlapping conformances for now than I was in the abstract.
Very interesting, thanks for doing this review!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution