> Couldn’t you use the same reasoning to claim there shouldn’t be access 
> control at all? Just add documention on methods you want to mark private 
> telling users of the library not to call them!

I guess you are making fun, but actually, good old Objective-C messaging works 
just that way:
You can call all those dangerous and forbidden private methods easily...
Writing special comments is just one way to document APIs; having no (official) 
documentation at all is documentation as well ("don't use this!").

Most technical limitations can be cracked by skilled hackers (working around 
"protected" is especially easy), so I really think that (for example) declaring 
a method "final" says "I don't want this to be changed in a subclass" in the 
first place, and the compiler error that is triggered when you try to break the 
limitation is little more but a remainder.

Enforcing limitations using hacks causes confusion, so I would never use such 
tricks in production code.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to