[swift-evolution] [Completing Generics] Completing protocol extension diagnostics

Brent Royal-Gordon brent at architechies.com
Fri Mar 4 02:58:03 CST 2016


> Brent, why is dynamic dispatching for protocol extension default implementations wrong in your mind? Wouldn't you agree that when static dispatching introduces such a side effect that it should not be automatically applied and perhaps a keyword should be added if you really wanted static dispatching nonetheless?
> 
> I think that code execution should not be affected by type casting, it feels like a very confusing part of the language.

I don't think dynamic dispatch is wrong; I think it's a large and technically challenging change. So in the spirit of incrementalism, I was trying to make cautious proposals which kept existing semantics intact but made them clearer, in preparation for perhaps eventually introducing dynamic dispatch. (Basically, I suggested that non-overridable protocol extension members should be marked `final` and it should be illegal to shadow them.)

But the feedback I got indicated that most people wanted a more aggressive proposal which introduced dynamic dispatch immediately. That's much harder to propose because it touches on all sorts of runtime implementation details I know nothing about, so I didn't try to draft a proposal.

(You are, perhaps inadvertently, currently demonstrating exactly what happened in those previous threads!)

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list