[swift-evolution] final + lazy + fileprivate modifiers

Joanna Carter joanna at carterconsulting.org.uk
Mon Feb 20 10:54:47 CST 2017


> Le 20 févr. 2017 à 16:59, Dimitri Racordon <Dimitri.Racordon at unige.ch> a écrit :
> 
> This is what I meant when I said that everybody has a story about that time it was so hard to do this because of that. This is not to say that I don’t want to spare a thought for people in large teams. I do recognise the issue, I just don’t think complicated access control is the silver bullet. Hence I’d rather favour simplicity of the language over expressivity of its access control.

Which is why I am suggesting simple access control, rather than the complications we are getting now.

> If ill-advised users want to do silly things with your awesome type, they will. I’ll bet we could find one person who thinks using reflection is such a clever way to bypass these so-called private properties.

Well, at least if your classes don't inherit from NSObject, reflection won't do them much good ;-)

> Yet if you google "private vs protected", the first 5 links are stackoverflow questions on the subject, and the rest of the first page are blog posts like “Pragmatism over Theory: Protected vs Private”. Despite decades of OO, those notions are still confusing for many people, and are intimidating for newcomers.

I suppose the problem is that so many "newcomers" never went to college and learnt the basics. They saw the promise of fame and fortune(?) via the AppStore, went out and got themselves a Mac and started coding without the faintest idea of what a class or a struct are, never mind what scope to use.

>> Ah, hang on, that makes…  one visibility to learn ;-)
> 
> Nope, it doesn’t. Extensible wouldn’t restrict the visibility as tightly as I described.

Does it really need that degree of control?

> That said, that list was a shameless exaggeration more than a critique of your proposition.

;-)

--
Joanna Carter
Carter Consulting



More information about the swift-evolution mailing list