Introducing FoundationLite framework as a portable subset of Foundation

TLDR: Since Foundation multi-platform is an afterthought and since we cannot directly impact the way it evolves, maybe it's not the best choice to have it full with utility features that every platform will need. Having another library that is thought multi-platform first and that we can direct the way to evolve through evolution process might be better.


FWIW Foundation supposed to be swift-corelibs-foundation/README.md at main · apple/swift-corelibs-foundation · GitHub and its evolution is public swift-corelibs-foundation/Status.md at main · apple/swift-corelibs-foundation · GitHub.

But actually, Foundation is more a library for working with Apple OS(iOS, macOS) and SDKs rather than a toolbox for Swift because a lot of it’s type are bound with features Darwin. Backporting Foundation to other OSs is a bad idea because it API rely on a lot of Darwin feature since it bound with AppleOSs, its evolution is not modifiable and multi-platform support is an afterthought.

Having a project driven by the community is really a hard and slow this I understand the resistance to open the evolution of Foundation so we cannot influences(mainly slow) it evolution which might impact Apple SDKs and platforms. In order to make Swift move forward, it needs to have more independent and multi-platform enabled library.

Foundation and Swift don’t seem to share the same goals like multi-platform support and evolution openness. Those are crucial for adaptation and Foundation can’t do them maybe it should be shipped with the Apple SDKs instead of Swift.

I don’t think we should do a Foundation Lite but we should add what is missing to the stdlib or make a new cross-platform library that will handle these task.

We have already seen that SPM, NIO, libSyntax needed some features like Process, URL, Data and re-implementing it.

Maybe we can use some blessed library like express here Large Proposal: Non-Standard Libraries even if would prefer a first party solution.

BTW I know Apple is working hard to bring Foundation on Linux and maybe Windows and a few important features have been recently added but the teams working seems rather small.

Some features of Foundation are developed in the open RFP: OrderedSet.

6 Likes