[Pre-Pitch] Import access control: a modest proposal

This seems great! I'm super excited to see imports getting some love! I like the reuse of public and internal as a way to make the behavior seem a bit more familiar for folks since they're already used to those keywords.

I think it would be a great time to fix this if it wouldn't be asking too much, assuming that folks could pretty easily recover from that, and they would have to have opted in to Swift 6 mode anyways. There's a big thread on potential less major solutions to this but I haven't gotten a chance to actually work on any of them Supporting strict imports

I think so too, from our attempts to use @ _implementationOnly in a modularized project for the same reasons you described this specific issue meant we can't use them nearly anywhere in our project because almost every module is included for some type you want to store at some point.

I think it's still worth considering a warning for this case because one thing I could see happening is a developer not realizing that another file in the library they were working on already importing something, and then their new public import foo not working as they expect, and they'd have to end up knowing about the fact that the internal import is preferred to understand they need to go search for other uses and add public to them.

8 Likes