I am wondering if we need to just refine what os means and disambiguate at the kernel level: #if kernel(Linux) or #if kernel(Darwin) so then we can have #if os(Ubuntu)#if os(helloSystem)#if os(Haiku)et cetera. I know these can get kinda fuzzy. But Android is a Linux distribution, HelloSystem is a distribution of FreeBSD.
When building on system that swift can't easily know what the specific OS is (because they might be in the same family), we could pass a flag to the compiler to specify.
Or it could assume from a provided SDK?
swift 'SampleApp' -os Ubuntu or swift 'SampleApp' -os Debian
This might also make it easier for platform authors (like helloSystem) to test their platforms with out having get os added to the swift compiler?
I feel strongly that we are using the word os in a confusing way.
The kernel isnât sufficient to distinguish the runtime environment. For example, you can run Debian userland on a FreeBSD kernel. Neither a âFreeBSDâ nor a âLinuxâ Swift runtime will work in such a system; it will either fail to link the kernel or the C runtime.
âOperating systemâ is the term that covers all the relevant pieces.
I hadnât considered subsystems, yet thatâs more of a trick, I believe to swift that would, in your example, render if os(Debian) true which is probably what we want for an app running in a Debian subsystem(?), should it not think it is in Debian. Still, I think you have a good point, I donât know all the implications of a sub-environment and all the expectations it could have. So thank you for that correction. Iâm frustrated with the terminology still. It feels off.