[swift-evolution] [Proposal] Protected Access Level

Goffredo Marocchi panajev at gmail.com
Sun May 29 06:43:46 CDT 2016



Sent from my iPhone

> On 29 May 2016, at 11:30, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> 
> There is nothing magical about being a subclass that ought to grant access to those methods

Hello Brent,

You must admit that when thinking about the words inheritance and parent/child classes the mind wanders to suggest the contrary actually. I know it is a personal loaded opinion, but I think having private headers to expose properties, variables, and methods to subclasses as leading to poor looking code generally (one must also keep in mind teams composed of less than pure elite coders) and in itself I have never liked the concept. 

Subclassing with abstract methods and protected access always felt natural and I think we should give that power to those who use Swift rather than tie OOP's arms a bit behind its back. It would be wrong if this were to happen in order to push people down to functional or POP approaches just because subclassing can be abused. 
I have always felt that we should give better options rather than restricting what we feel it may be abused (yet useful if used correctly).


More information about the swift-evolution mailing list