[swift-evolution] Proposal: Universal dynamic dispatch for method calls

Brent Royal-Gordon brent at architechies.com
Tue Dec 8 17:00:27 CST 2015


> How does this handle the case where the extension was not done in the
> same module that defined the protocol, and the extension method's name
> is the same as a method on one of its implementing types (from the same
> module, or another module that can see the protocol but not the
> extension)?

I’m not sure I understand what you’re asking; an annotated code sample might help. But if I *do* understand what you’re saying, that’s what @incoherent on an import is meant to resolve—the case where you import a bunch of modules which don’t individually conflict, but as a group do.

Keep in mind that what I’m proposing here doesn’t actually change Swift’s runtime behavior at all. Note #2—you’re *required* to make protocol extension members `final` unless they’re listed in the protocol declaration. What I’m proposing is merely a series of compile-time statements used to tell swiftc that, yes, I know this is going to happen.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list