Wednesday, June 7, 2023

Swift’s Upcoming Feature Flags

James Dempsey:

The idea of being able to adopt upcoming changes sooner rather than later is a good one. However, adding an ever-increasing number of separate compiler flags for each upcoming feature does not scale well.

To address this, Swift evolution proposal SE-0362, implemented in Swift 5.8, details a generalized mechanism for enabling upcoming features.

[…]

SE-0362 also introduces a new hasFeature() compilation condition that checks whether a feature is enabled. This allows you to write code that uses a feature if present or uses alternate code if not present.

Previously:

Comments RSS · Twitter · Mastodon

Leave a Comment