[swift-evolution] [Review] SE 0192 - Non-Exhaustive Enums

Brent Royal-Gordon brent at architechies.com
Wed Dec 20 19:53:11 CST 2017


> On Dec 20, 2017, at 12:54 PM, Charlie Monroe via swift-evolution <swift-evolution at swift.org> wrote:
> 
> the choice to make them non-exhaustive by default is not in line with everything else in Swift - everything else is generally closed by default - public (-> final in other modules), no access modified (-> internal), ...


It is precisely in line with the `public`/`open` split. They both come from the principle that the default behavior should bind library authors as little as possible. The default for public classes is non-subclassable because going from non-subclassable to subclassable doesn't break anything, but the opposite direction does; the default for enums should be non-exhaustive because going from non-exhaustive to exhaustive doesn't break anything, but the opposite direction does.

-- 
Brent Royal-Gordon
Architechies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171220/297e8aff/attachment.html>


More information about the swift-evolution mailing list