would package
declaration expose the declaration in extensions found in other files? Something requested here: Missing a level of access control on class/struct
// File A
public class SomeObject {
private var propertyA: Int
package var propertyB: String
public init() {
// ...
}
}
// File B
extension SomeObject {
func doSomething() {
propertyB = "some value" // Ok, propertyB is visible at package level, including the defining module
}
}
But you know what? This whole package access modifier sounds an awful lot like a byproduct of having proper namespaces and with namespaces we'd have submodules as well. Some discussions around namespaces here An Enum Based Approach to Namespaces and here Namespaces × submodules
I think if namespaces could access same package internals and extend them there wouldn't be a need for a package access modifier, forced uses of @testable or @_spi. As in namespaces would be open
within a package and final
outside the package and thus give all the functionality package
access modifier tries to bring