Should access control on extensions be banned in Swift 6?

The reasoning, as I understand it, was that extensions do not “exist” as an entity and thereby cannot “contain” their members. So instead, the notation {{access-modifier}} extension is a one-of-a-kind “shorthand” totally distinct from the visually similar {{access-modifier}} {{type-introducer}}.

Community members who argued against my pitch to remove this feature stated that, indeed, the requirement to write public in front of every public API is exactly what they want to use this feature to avoid. This is irreconcilable with the countervailing view that all public APIs should be annotated on the declaration itself, but the core team was unwilling to consider weighing in on this absent a consensus being reached.

5 Likes