I just wanted to put focus on the visibility issues, which you could not see (it seems). Your general arguments about ways to improve protocols so that not only classes could be enhanced remain quite valid and inspiring.
Gwendal
···
Le 4 mars 2016 à 20:24, Gwendal Roué <gwendal.roue@gmail.com> a écrit :
Le 4 mars 2016 à 08:45, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> a écrit :
For modeling subtype requirements we would need the ability to declare protocol members with reduced access scope like private or internal and hopefully protected, as subtype requirements most often are not public.
I've spoken about this elsewhere, but:
- For both abstract classes and protocols, all required/abstract members need to be visible everywhere you're permitted to conform/inherit.
- There is currently no way in Swift to decouple a protocol's/class's visibility from the ability to conform to/inherit from it, so neither construct can currently offer this feature.
- However, this feature is likely to come at least for classes as part of resiliency. I think it's a good idea for protocols, too.Brent, please consider the sample code below: