On Mon, Aug 22, 2016 at 7:02 PM, Charles Srstka <[email protected]> wrote:
> On Aug 22, 2016, at 6:33 PM, Xiaodi Wu <[email protected]> wrote: > > > > That's a good point. Since you're proposing an optional keyword, though, > aren't you describing a linter functionality? > > If the optionality of the keyword bothers you, there are multiple ways to > do it: > > Solution #1: Optional keyword. > > protocol P { > func giveUpTheFunc() > } > > struct S: P { > implement func giveUpTheFunc() > } > > Solution #2: Required keyword, but with a manual override for protocols > that need to be retroactive. > > protocol P { > @retro func giveUpTheFunc() > } > > struct S { > func giveUpTheFunc() > } > > extension S: P {} > > Solution #3: No keyword, but extensions that conform to protocols can’t > have anything other than protocol conformances unless they’re private. > > protocol P { > func giveUpTheFunc() > } > > struct S {} > > extension S: P { > func giveUpTheFunc() {} > func tearTheRoofOffTheSucker() {} // error! > } > > but this is okay: > > extension S: P { > func giveUpTheFunc() { > tearTheRoofOffTheSucker() > } > > private func tearTheRoofOffTheSucker() {} // works :-) > } > > There are definitely a range of ways to make protocol conformance more > explicit. Which one is the best, I’m not sure, but we could probably flesh > out the pros and cons of these, as well as any other options that I haven’t > thought of, with some discussion. > > Charles > Sure, I too am not convinced we've exhausted all the design possibilities. Here are some previous related threads (including one launched by a core team member): https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160104/005380.html https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160229/011792.html https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160425/015920.html Somewhat related, but definitely a different topic: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160516/018286.html
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
