-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for NSUnsupported to indicate non-availiability, and use annotations #1150
Conversation
@swift-ci please test |
Looks like an unrelated failure:
@swift-ci please clean test |
@swift-ci please clean test |
@swift-ci please test |
As discussed on the mailing list, I support this general approach but think we should only add |
@ianpartridge There's no reason to not start using |
@alblue I think the automerge into swift-4.0 branch for corelibs-foundation is still active (according to my github feed) |
Yes it is: a248ca2 |
@alblue The semantics are changing though - if |
@ianpartridge The key difference between Finally, the goal of having a separate string is so that |
I totally agree about making sure that But I wonder how we are going to decide which APIs become |
Good question for @parkera – should we just remove the types instead of deprecating them? |
If the type is there, but marked as unavailable (not deprecated), then it's a pretty clear signal that we do not intend for it to be used, as opposed to it looking like we somehow forgot it. Also, portability efforts would probably be easier. On the other hand, it could add a bunch of noise. |
There are a bunch of classes on Darwin that we didn't bother even stubbing out here, and it seems like a waste of time to go find all of them (plus categories on Foundation types that higher level frameworks provide on Darwin) and add them, just to mark them unavailable. |
When developing cross-platform applications, an `NSUnimplemented()` is currently used to identify when a method is not and will not be implemented. Since `NSUnimplemented()` is used to also mean 'not yet implemented', using a distinct name for the same functionality will allow the two states to be distinguished, in the same way that `NSRequiresConcreteImplementation()` is used to indicate that a subtype must provide the behaviour.
To simplify the contribution, I've rebased and just have the @swift-ci please test |
@swift-ci please test |
Thanks @alblue |
As suggested in https://lists.swift.org/pipermail/swift-corelibs-dev/Week-of-Mon-20170724/001254.html it would be desirable to have a differential macro (rather than
NSUnimplemented()
) to indicate whether the functionality is missing by design in this library, to distinguish it from things that are not yet implemented.This change adds
NSUnsupported()
as a variant ofNSUnimplemented()
that has a different error message, and allows the code to be differentiated at the point of definition, as well as uses availability macros on specific methods and types known to not exist on other platforms.Note that marking the APIs as
unavailable
instead ofdeprecated
would mean that they would cause compile-time errors. We may want to do that in a future release.