[swift-evolution] 'Public' class visibility specifiers

Joanna Carter joanna at carterconsulting.org.uk
Tue Feb 21 04:47:53 CST 2017


> Le 21 févr. 2017 à 10:28, Slava Pestov <spestov at apple.com> a écrit :
> 
> There is one important difference, but it is rather obscure. ‘final’ allows a class to conform to protocols where ’Self’ appears in invariant position in requirements. For example, say you have the following:
> 
>> Also worth noting that removing ‘final’ from a class is going to be an ABI breaking change (and source compatibility too), whereas changing a ‘public’ class to ‘open’ poses no such difficulty.
> 
> I might be in favor of a proposal to just remove ‘final’ altogether, though, leaving us with just open and public. I’m not sure how much the ability for classes to conform to such protocols matters in practice.

I am not advocating removing 'final' from the language ; rather of removing 'open', which is "foreign" to anyone coming from any other language.

My suggestion was to revert 'open' back to 'public' for visibility purposes and to use 'final' as the means of controlling inheritance/overriding that it has always been.

IMO, it is 'open' that is superfluous to requirements.

--
Joanna Carter
Carter Consulting



More information about the swift-evolution mailing list