[swift-evolution] Static Dispatch Pitfalls
matthew at anandabits.com
Fri May 20 13:04:45 CDT 2016
> On May 20, 2016, at 12:35 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>> On May 20, 2016, at 9:17 AM, Austin Zheng <austinzheng at gmail.com> wrote:
>> I almost want to propose forbidding methods in protocol extensions unless they're also a requirement in the protocol itself, but I don't think that would fly.
> I don’t think that would fly :-). That said, has anyone considered requiring a keyword on the method in the protocol extension that makes it explicit that the dispatch is non-dynamic?
I believe `final` has been discussed previously for this purpose. IIRC the intent was to *disallow* the type to have its own method with the same signature. However, that interacts poorly with retroactive conformance which means `final` is probably not best choice.
Before we introduce a keyword I think we should be sure the current semantics are what we plan to stick with. I haven’t seen any good alternatives proposed, but people do keep bringing up this topic. The desire is usually to change the semantics, not just clarify the existing semantics.
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution