# Function in private extension must be declared private because it uses a private type?

**URL:** <https://forums.swift.org/t/function-in-private-extension-must-be-declared-private-because-it-uses-a-private-type/44463>\
**Category:** Using Swift\
**Created:** [February 5, 2021, 12:16am UTC](https://forums.swift.org/t/function-in-private-extension-must-be-declared-private-because-it-uses-a-private-type/44463 "2021-02-05T00:16:54Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [February 5, 2021, 6:57pm UTC](https://forums.swift.org/t/function-in-private-extension-must-be-declared-private-because-it-uses-a-private-type/44463/8 "2021-02-05T18:57:56Z")

</div>

As someone who was against SE-0025 _and_ SE-0169 I agree with @Nevin's conclusions:

- Pre-SE-0025, `private` meant `fileprivate`, and so `private extension` meant `fileprivate extension`.

- With SE-0025 (but not SE-0169), @xwu's explanation is correct: `private extension` is effectively still `fileprivate` because (a) applying `private` to all members would have been useless, and (b) it was a goal (though not one I agreed with) to make `fileprivate` rare if people wanted it to be. Therefore, "`private` means enclosing scope and that includes extensions, which are always at the top level of a file".

- With SE-0169, `private` for all methods in an extension became meaningful again…but it would be a source-breaking change to have those methods _not_ exposed to other types in the file. Perhaps that change should have been made in Swift 5 as a breaking change, and I'd be in favor of making that change the next time we break source compatibility, with a corresponding deprecation of `private extension` in favor of `fileprivate extension` in existing language modes when we do.

---

_[View the full topic](https://forums.swift.org/t/function-in-private-extension-must-be-declared-private-because-it-uses-a-private-type/44463)._
