4 ms·
The Foundation library on non-Apple platforms is open source: https://github.com/apple/swift-corelibs-foundation https://github.com/apple/swift-corelibs-foundat
by andrewjl 5y ago
The Foundation library on non-Apple platforms is open source: https://github.com/apple/swift-corelibs-foundation https://github.com/apple/swift-corelibs-foundation and intended to reach parity with the Apple version.
> Our primary goal is to achieve implementation parity with Foundation on Apple platforms. This will help to enable the overall Swift goal of portability.
- lolinder 5y agoBut why are these even two separate libraries? Is it normal for different platforms to have different implementations of the standard library? I'd assumed that most of the library would have been written in Swift itself, which should theoretically make it be as platform-independent as Swift is.
- olliej 5y agoThis is assumption from first principles The Apple versions of foundation have to be compatible with the Foundation/CoreFoundation equivalents. They also have more than a decade of binary compat to maintain
- andrewjl 5y agoFoundation is not the standard library of Swift. Swift has its own standard library that is bundled with the language on all platforms that are supported. And Foundation itself isn't written in Swift, a good portion is written in C. > A significant portion of the implementation of Foundation on Apple platforms is provided by another framework called CoreFoundation (a.k.a. CF). CF is written primarily in C and is very portable. Therefore we have chosen to use it for the internal implementation of Swift Foundation where possible. As CF is present on all platforms, we can use it to provide a common implementation everywhere. https://github.com/apple/swift-corelibs-foundation/blob/main/Docs/Design.md#portability https://github.com/apple/swift-corelibs-foundation/blob/main...