-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Similar to strict concurrency, existential any is going to be enabled by default in the future.
It is not enabled yet in Swift 6, but it will be in a future language version:
The Language Steering Group has decided that one previously-accepted upcoming feature, ExistentialAny, will not be enabled by default in Swift 6. SE-0335: Introduce existential any introduces the any keyword to identify existential types. The proposal also specifies that "bare" protocol names will no longer be permitted as types---they must either use any or some, as appropriate---under the upcoming feature flag ExistentialAny. Given the concerns about migration to consistent use of existential any in the language, and the expectation that additional language improvements will be coming that might affect the end result of that migration, the Language Steering Group is deferring the source-incompatible changes in SE-0335 to a future language revision.
Per SE-0335:
Transitioning to any
The new any syntax will be staged in over several major Swift releases. In the release where any is introduced, the compiler will not emit diagnostics for the lack of any on existential types, save for the aforementioned cases. After any is introduced, warnings will be added to guide programmers toward the new syntax. Finally, a missing any will become an unconditional error, or plain protocol names may be repurposed — in Swift 6 or a later language mode.
Related: #147347