I think there's a point where we can accept that everyone else is doing it and if they're not having issues with it maybe we'll be fine.
Also if we store them in caches and such by relative path, which we should've always done, this is a non-issue.
If someone is using #fileID for something critical instead of just debugging then it was probably a bad idea to begin with.
Would a compiler flag be a reasonable option here? It could be introduced off by default, allowing people to opt in to the multi-file behavior, and then eventually be switched to enabled by default. Library code like NSCoding could warn when the flag is enabled to alert users of the potential for data loss or other consequences.
A flag obviously comes with a maintenance burden, but it is something that could put the language on a path to phasing out unwanted old behavior.
That came from @jrose's blog posts. One of the difficulties of changing how names are mangled is that the mangled names have been used in archives created with NSCoding, which means the mangled names have trickled all the way to end-user space. It sounds like great pains have to be taken to make changes to the mangled names to avoid end-user facing breakages.
Bonus points for a migration strategy for old use cases like existing NSCoding archives. Bonus bonus points if we can ensure that the new mangled names can no longer trickle into user space.
I think the real solution here is to hard break the existing code. Hear me out.
NSCoding uses mangled file names in its output. That means that renaming a source file will break those archives too. That’s a really unexpected behavior that should be recognized as a bug. Any other code that uses the mangled names may have similar bugs. We should make the mangled names internal to the compiler and break all of this buggy code.
Effected libraries should change to either reimplement the mangled names or replace them with something more sensible.
In this approach no one will break user data by building on a later swift version, but they (or the libraries developers they depend on) will have to make a choice about how to proceed.
We punt this problem to user space where it belongs and can unshackle the compiler.
I really don’t think there is a better solution, but the current situation is a house of cards and must be addressed.