Instead of a new access modifier, I would have preferred:
“@Package import MyModule”
which would work similarly to “@testable import”
https://github.com/apple/swift-evolution/blob/main/proposals/0386-package-access-modifier.md
Instead of a new access modifier, I would have preferred:
“@Package import MyModule”
which would work similarly to “@testable import”
https://github.com/apple/swift-evolution/blob/main/proposals/0386-package-access-modifier.md
@jsq so you would have wanted to be able to import internal API of other modules?
@NeoNacho @jsq
Lukewarm take: this is a good addition; it’s fileprivate that was the mistake
@jsq @NeoNacho
The mailing list hashed over this exact argument at length when `open` was under discussion, and IIRC the argument against it was that designing for inheritance by third parties is so wildly fraught and so easily breaks encapsulation (all true) that it should not be the de facto default.
@jsq sure but what’s the API you get? @testable gives you access to anything that’s internal, I think we felt that was too open.
@NeoNacho I was going to say make things private that you don’t want visible. But I can see how that might not always work.
Still, I feel like the extra access modifiers are just compensating for edge cases in what’s ultimately a developer’s shitty design. Like, we don’t need `open` when we have `public final`
@NeoNacho no, this would have to be somehow “magically restricted” for usage only in package contexts, just like how you can’t do @testable outside of a testing target
@inthehands @NeoNacho yeah and I agree.
My issue is that both “final” and “open” exist and now “public” has 2 meanings depending on context.
I think classes should have just been final by default, obviating the need for the keyword. Then you opt-in to subclassing with “open”
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.