[swift-corelibs-dev] Unavailability macros for APIs that aren't going to be implemented on Linux?
alblue at apple.com
Fri Jul 28 09:07:36 CDT 2017
I've pushed a change which will add an unavailability warning for a method which was deprecated at the point of being added to Swift, has never worked, and likely never will:
There are some other types in Foundation which aren't likely to ever be implementable in Swift on Linux; Bundle.unload, NSPort/PortMessage, copy(with zone) etc. The majority of these methods use NSUnimplemented(), which means there are often unannounced runtime errors that you can get from something that compiled correctly.
I'd like to suggest that we attempt to resolve this problem, either by removing the features whihc are never going to be implemented (e.g. by commenting out the calls) or by marking them as @available(*,unavailable, message:"Not available on the Linux platform"). That way, calls that are known cannot work can be identified at compile time instead of at run-time.
I hope we'll then be able to remove the NSUnimplemented calls on the types that can never be implemented, so that we can focus on those types and functions that we can. Alternatively we can define a different macro, say NSUnavailableOnLinux, to indicate that this functionality cannot be present (as opposed to just leaving it blank).
What do you think?
$ git grep -c NSUnimplemented | sort -n -r -k2 -t:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-corelibs-dev