[swift-evolution] Static Dispatch Pitfalls

Brent Royal-Gordon brent at architechies.com
Sat May 21 15:16:42 CDT 2016


>> Where was proposed to force them to be final and was just trying to provide an example in which the conforming class may want to override them, so forcing them final isn't a good idea.
> 
> Again, nobody ever proposed forcing them final.  The proposal was to use final as a way to document the existing behavior.  

I *did* propose forcing them final, and I'm still very skeptical that a `nondynamic` keyword that does nothing when you shadow the method is a good idea. People are still going to naïvely try to override these methods and be surprised when it doesn't work. A `nondynamic` keyword at the original declaration site will help them understand what happened when they're investigating the bug, but it still seems like this kind of code is so suspect that Swift ought to flag it from the start.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list