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

Knut Lorenzen lo.knut at gmail.com
Sun May 15 14:15:30 CDT 2016


I think internal as default is bad, because it discourages encapsulation.

Building scalable software components relies on hiding implementation details to create layers of abstraction. It’s a fundamental principle of object-oriented software design. Most other OOP languages have private default.

The linked doc doesn’t explain the advantages of internal as default in detail:

> By default, most entities in a source file have internal access. This optimizes for the most common case—a single-target 
> application project—while not accidentally revealing entities to clients of a framework module.

Optimizes for what? Build time? Brevity?

Knut

> Have your read
> https://github.com/apple/swift/blob/master/docs/AccessControl.rst?
> 
> I prefer the current rationale behind "internal" by default.
> 
> Stephen


More information about the swift-evolution mailing list