[swift-evolution] [Proposal] Sealed classes by default

Xiaodi Wu xiaodi.wu at gmail.com
Fri Jul 1 02:23:27 CDT 2016


That starts to look an awful lot like a fifth access level just for classes
(I know you're not proposing one, but it could start to look that way to a
user). I think there's much to be said for having the word public in front
of things that are public. Unless, of course, your strawman keyword is a
much maligned compound word that begins with "public", like
"publicoverridable".
On Fri, Jul 1, 2016 at 01:54 Brent Royal-Gordon <brent at architechies.com>
wrote:

> > If we're going to go along those lines, we should just use
> public(subclassable) and public(overridable).  We can fall back on those if
> necessary; I would just like to continue looking for better alternatives.
>
> I would prefer to have a *single* keyword which meant both public and
> overridable. That would minimize the impact of this feature—instead of
> writing:
>
>         public class MyViewController: UIViewController {
>                 public func displayMe(_ me: person) { … }
>         }
>
> You'd write (strawman keyword):
>
>         openseason class MyViewController: UIViewController {
>                 openseason func displayMe(_ me: person) { … }
>         }
>
> And then `MyViewController` could be subclassed, and `displayMe`
> overridden.
>
> --
> Brent Royal-Gordon
> Architechies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160701/d5141b49/attachment.html>


More information about the swift-evolution mailing list