Open gwynne opened 1 year ago
Yes, this is a limitation inherent to the fact that hasFeature
is itself a new feature; we can't go back in time and ship hasFeature
in past releases.
Yes, but a compiler that does understand it (i.e. 5.8 or later) should apply the "don't parse new syntax" behavior without requiring the compiler directive as part of the same control statement.
The following code produces an error in Swift 5.8 and
swift-DEVELOPMENT-SNAPSHOT-2023-03-23-a
:To support compilers older than 5.8, one must write:
This is awkward and requires inline comments to avoid confusion. It's already ugly enough to have to repeat the else branch when supporting 5.7 and earlier.