[swift-evolution] Make access control private by default.

Matthew Johnson matthew at anandabits.com
Mon Dec 7 12:48:22 CST 2015


> +1 to this from the point of view of correctness. But it's important to realize the drawback in the language "friendliness".
> Other defaults that I think could be reconsidered along these lines: final by default for classes and final by default for methods. 

+1 to final on classes and class members being the default.  I have wished this was the case ever since Swift was released.  It is not uncommon to have a need for a reference type without a need for inheritance.  Superclasses should be intentionally designed to be subclasses and the author required to opt-in to subclassing and member overrides where that is required by the design.

I'm less sure about private being the default but willing to consider arguments for it.  I also think any change to default access control should be considered in conjunction with any other modifications to access control such as the 'classified' proposal.


More information about the swift-evolution mailing list