I apologize for posting to this thread after the review period has ended.
I realize much discussion has revolved around the wildcard character and its meaning regarding symbol availability. The only issue I have with the current proposal is the use of the wildcard character.
Although the wildcard in #available
and #unavailable
has a very precise meaning, a wildcard character in general has a meaning of ‘match everything’.
Even without understanding the precise meaning of the wildcard character, the fact that platforms other than iOS all resolve to true makes sense in the statement:
if #available(iOS 13.0, *)
The wildcard can be understood as ‘match or consider available every version of every other platform’. Therefore, for a non-specified platform this always resolves to true. I believe this is clear even to developers without deep knowledge of the mechanics of #available.
I understand the logic in the proposal that leads to the wildcard resolving to false. I also agree that non-specified platforms always resolving to false is the desired behavior.
if #unavailable(iOS 13.0, *)
However, I think people will find this spelling confusing, since a wildcard traditionally matches everything. I realize there is the suggestion to clarify this in the documentation, but I believe fighting against the widely understood meaning of a wildcard will lead to confusion.
Personally, I would favor a spelling without the wildcard:
if #unavailable(iOS 13.0)
I can think of this spelling as:
If compiling for iOS, this resolves to true if iOS 13.0 is unavailable. No other platform is referenced, either explicitly or via wildcard, so no other platform is considered and therefore no other platform can resolve to true.
Since there is no representation of other platforms via a wildcard, the unavailability statement simply doesn’t consider other platforms. Therefore the if statement is never true for any other platform.
This, I think would match with most developers understanding of how a wildcard works. If it’s there, every other platform matches. If it’s not there, no other platform matches.
I realize this is probably not the way the compiler implements or thinks about about platform matching. But I think the notion of ‘if it’s not mentioned in the if statement, it’s not considered’ is straightforward.
I also think that this spelling best reflects what the proposed behavior will be. Platforms not mentioned in #unavailable
are not considered and therefore can't be true. Platforms mentioned via the wildcard in #available
are always considered available and therefore are always true.
So, my preference would be for the ‘no wildcard’ spelling.
One Other Suggestion
I can see the point of view that someone could read the 'no wildcard' spelling as I’m on another platform, obviously iOS 13 is unavailable. In practice, I don't believe that will cause a great deal of confusion.
But, perhaps a spelling like the following would clarify the behavior:
if #unavailable(iOS 13.0, !*)
The presence of the wildcard character mirrors the notion that all versions of all other platforms are matched by the statement.
The presence of the negation symbol at the least lets the reader know something other than a plain wildcard match is going on.
It also strongly suggests the negation of the matching, that other platforms will return false and drop into the else block.
Between these two and the proposed solution, I prefer the spelling without the wildcard:
if #unavailable(iOS 13.0)
Again, I apologize for the late post.