[swift-evolution] [Pitch] Requiring proactive overrides for default protocol implementations.

Erica Sadun erica at ericasadun.com
Fri Apr 29 10:24:17 CDT 2016


> On Apr 29, 2016, at 8:38 AM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> I'd be keenly interested in something that would improve the experience of conforming a type to a protocol. I think others would as well. A sufficiently sophisticated solution would:
> 
> * catch unintentional typos that cause required functions to be incorrectly named
> * show, ideally prospectively, which required functions have default implementations
> * clarify (and this is obviously a cherry-on-top scenario) what protocol requirements any particular function helps to satisfy as well as which combination of implementations is used to synthesize a default implementation of another function (e.g. <= synthesized from < and ==; this would help to determine whether it might be more efficient to roll your own override)
> * support all retroactive modeling scenarios currently supported
> 
> I tried to propose a keyword-based solution (less sophisticated than yours) a while back, and I've been convinced that the drawbacks in terms of decreased expressiveness in retroactive modeling might be insurmountable. Perhaps it would be worthwhile exploring improvements in tooling and documentation (including annotation of the code itself) in order to address some of these areas?

Hop over to the protocol non-conformance clause thread for a moment, if you could.

-- E




More information about the swift-evolution mailing list