Yeah, as nifty as it would be to accomplish without changing the surface level syntax, I'm inclined to agree with @frozendevil: I don't think it's tenable to just stop warning about internal uses of deprecated symbols. At the very least I think this behavior would need to be enabled by a compiler flag, but then users would have to choose between using other libraries' deprecated symbols and being able to use deprecations for themselves internally.
If we want to reuse the deprecation-silencing behavior of @available(*, deprecated)
for this purpose, I think it would be better to take an approach such as visibility modifiers for declarations, as @allevato mentions above. So the undeprecation of WebView
would look something like:
@available(*, deprecated(public))
typealias WebView = UIKit.WebView
which would mean "this symbol is deprecated at the public
visibility level, but not at the internal
level."
Although, as I write it out, I'm not sure if this solution feels quite right, either. Ostensibly, the local redeclaration of WebView
is only internal anyway, so it seems like a bit of an abuse to say "this internal
symbol is deprecated for public
uses." It also seems like this would just decay to the scope-level silencing feature, since presumably:
@available(*, deprecated(public))
internal func noDeprecationWarningsHere() {
// use deprecated symbols to your hearts content
}
would exhibit the same deprecation-silencing behavior.
ETA: I suppose this is also (for me) an argument against a compiler flag for disabling internal deprecation warnings, since that would also turn @available(*, deprecated)
into a scope-level deprecation silencing mechanism.
So, all that's to say, as a proponent of silencing at the granularity of declaration use, I think reusing @available
doesn't work quite well enough for me. I think this feature is deserving of a new annotation which directly expresses "I know this particular symbol is deprecated but I'm going to use it anyway".