[swift-evolution] [Accepted] SE-0185 - Synthesizing Equatable and Hashable conformance

Xiaodi Wu xiaodi.wu at gmail.com
Sat Aug 19 15:31:37 CDT 2017


On Sat, Aug 19, 2017 at 3:26 PM, Goffredo Marocchi <panajev at gmail.com>
wrote:

> Sorry, I thought that the default implementation in the protocol extension
> was how this was provided.
>
> Providing Default Implementations
>
> You can use protocol extensions to provide a default implementation to any
> method or computed property requirement of that protocol
>
> https://developer.apple.com/library/content/documentation/
> Swift/Conceptual/Swift_Programming_Language/Protocols.html#//apple_ref/
> doc/uid/TP40014097-CH25-ID521
>


There are default implementations and extension methods. Both are written
inside protocol extensions. Default implementations are dynamically
dispatched, but extension methods are not. A default implementation
implements a protocol requirement. An extension method adds a method to a
protocol which is not a requirement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170819/5d58fc7c/attachment.html>


More information about the swift-evolution mailing list