[swift-evolution] [Draft] Remove support for final in protocol extensions

Brian King brianaking at gmail.com
Tue Mar 7 21:23:22 CST 2017

Hey Folks, This draft proposal addresses starter bug SR-1762. I believe
this is in scope for Swift 4 since it impacts source compatibility. It's
not a very exciting proposal, but I think it will help make Swift a little
more consistent.




This proposal suggests removing support for the final keyword when
declaring a function in a protocol extension. The presence of the final keyword
does not currently generate an error message, and it does not actually
modify the dispatch behavior in any way.

In the original protocol model of Swift, a developer could use the
final keyword
when declaring a function in a protocol extension to ensure the function
could not be overridden. This keyword has no use in Swift's current
protocol model, since functions in protocol extensions can not be
overridden and will always use direct dispatch.

The compiler should generate an error or warning when the final keyword is
used on a function declaration inside of a protocol extension. This is
consistent with the use of final in structs and enumerations.

This change will impact source compatibility. To maintain compatibility
with Swift 3, a warning will be generated in Swift 3 mode instead of an
error message.
on ABI stability

This has no effect on ABI stability
on API resilience

This has no effect on API resilience

The only alternative would be to not fix this bug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170307/de8466e3/attachment.html>

More information about the swift-evolution mailing list