private & fileprivate


(Daniel Tartaglia) #1

This discussion reminds me of Eiffel’s access system. Instead of having these generic “public/private” distinctions, in Eiffel the programer specifies exactly which methods can be used by which classes. So a “public” method would be defined as accessible to “[Any]” and a private method would be defined as accessible to “[Self]”. If you want to grant access of a particular method to only particular helper classes, you would specify them.

Having a system like that would solve Karl’s problem because it wouldn’t matter what physical file the classes are in.


(Trans) #2

That sounds absolutely horrible. Keep building walls and ultimately you'll
never leave your bike shed.

···

On Oct 9, 2016 1:23 PM, "Daniel Tartaglia via swift-evolution" < swift-evolution@swift.org> wrote:

This discussion reminds me of Eiffel’s access system. Instead of having
these generic “public/private” distinctions, in Eiffel the programer
specifies exactly which methods can be used by which classes. So a “public”
method would be defined as accessible to “[Any]” and a private method would
be defined as accessible to “[Self]”. If you want to grant access of a
particular method to only particular helper classes, you would specify them.

Having a system like that would solve Karl’s problem because it wouldn’t
matter what physical file the classes are in.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Rien) #3

the programer specifies exactly which methods can be used by which classes.

That IMO is the only sensible solution. Everything else -even in the name of simplicity- will be insufficient and complicate matters.

···

On 09 Oct 2016, at 19:22, Daniel Tartaglia via swift-evolution <swift-evolution@swift.org> wrote:

So a “public” method would be defined as accessible to “[Any]” and a private method would be defined as accessible to “[Self]”. If you want to grant access of a particular method to only particular helper classes, you would specify them.

Having a system like that would solve Karl’s problem because it wouldn’t matter what physical file the classes are in.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution