[swift-evolution] Static Dispatch Pitfalls

Charles Srstka cocoadev at charlessoft.com
Fri May 20 12:48:30 CDT 2016


> On May 20, 2016, at 11:52 AM, David Waite via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> 
>> On May 20, 2016, at 10:43 AM, Brandon Knope via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> From the compilers/runtimes perspective why couldn't the declaration automatically be included in the main protocol definition as if it was defined there?
> 
> Assuming you have protocol extenders and protocol implementors as different people, they are competing in the same problem space. The odds of an unintentional name collision is higher than normal, in which case the person implementing a protocol just unknowingly changed behavior for everyone relying on that extension.
> 
> The implementors can’t look at the protocol to find out the list of requirements on the protocol anymore - they have to also find every extension.

Implementers have to find every extension *already*, since there’s no other way to know if a method on a protocol actually needs to be implemented, or whether it already has a default implementation. Failure to do so results in a lot of reinventing the wheel.

Charles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160520/a7546faa/attachment.html>


More information about the swift-evolution mailing list