I'm seeing a few differences in initializer signatures between Mac and Linux for InputStream and OutputStream classes (I'm trying to subclass them)- specifically on Linux I'm being made to override OutputStream's init(toMemory: ()) and am not allowed to invoke the zero-arg init() on Inputstream. To get OutputStream compiling across both, the compiler is making me do this which feels quite weird
I presumed these APIs are stable given the Core Foundation heritage, but am I doing something dumb or is there documentation for these class/platform disparities I can read somewhere?
The Linux implementation should mirror the macOS implementation, so any divergence not otherwise documented is a bug worth fixing.
Haven’t delved into the specifics of what you’re running into here, but if you have a straightforward case of something that compiles with macOS Foundation but not the Linux version, then it’s worth filing a bug over at bugs.swift.org
(Ideally, one would try to see if it’s been addressed already in Swift 5.2, though.)
Comparing the source swift-corelibs-foundation/Stream.swift at main · apple/swift-corelibs-foundation · GitHub and in Xcode there are slight differences. The GitHub source shows the required keyword on the init(toMemory method but in Xcode it does not. There's a note next to the method in the source but it's not obvious to me why the difference. The Xcode description of these classes also has @available(iOS keywords that aren't in the GitHub sources so I guess we can deduce that Apple changes the code as needed to suit its own needs.
The implementation of Stream.init() makes it clear it can only be called by a subclass.