[swift-evolution] [Proposal] Nested extensions

Tino Heth 2th at gmx.de
Sat Apr 15 10:23:49 CDT 2017

> I think you misunderstand. The rules of access modifiers do not currently work with nested extensions without modification. How do you intend to modify the rules?
There are no nested extensions now, right? So there are also no rules for their access modifiers, if I'm not missing something fundamental (which might be the case — please elaborate on this if my assumptions are wrong).

Afaik, the ideas you mentioned wanted to change how access modifiers of extensions work, whereas I don't want to change any of their rules.
I even don't want to add any new rules:
Just like today, an extension would introduce a separate scope, and the only meaning of its access modifier would be to act as the default for all elements of this extension.

The single change for nested extensions compared to regular ones would be the treatment of private (which changes the default for members to fileprivate, so it's rather inconsistent anyways, and not a real new rule, but rather removal of an exception).
This change wouldn't be necessary, but it would be inconvenient to manually mark the majority of its members as private.

More information about the swift-evolution mailing list