[Accepted with modifications] SE-0335: Introduce existential `any`

Hello Swift Community,

The review of SE-0335: Introduce existential any has completed. We had great discussions throughout the pitch and review phases of this proposal. The Core Team has accepted this proposal with small modifications. Several issues came up during the discussion that the Core Team would like to comment on:

  • The proposal introduces the any P syntax in Swift 5.x and requires it in Swift 6, but does not provide a specific transition path for existing Swift 5.x code. The Core Team feels that this (and other) proposals that deprecate or remove existing syntax in favor of a new syntax need to stage such changes over several major releases (e.g., 5.5, 5.6, not counting point releases like 5.5.1). Specific timelines will be discussed in a separate forum thread, but the goal is that that one can write code that compiles without warnings for the current Swift release and at least one major release prior (possibly more, pending the above discussion), after which warnings can be introduced to guide users to the new syntax in existing language modes. Finally, the old syntax can be removed or repurposed only in a new major language version. The proposal will be amended to capture this transition plan.
  • The Core Team feels that the any P syntax better fits the direction of the language than alternative proposed syntaxes (e.g., Any<P> ), particularly due to its dual nature and expected co-evolution with the opaque type syntax some P .
  • The Core Team feels that the proposal strikes the right balance by allowing Any and AnyObject to be interpreted as existential and also to be used as a generic construct, which provides greater source compatibility than the alternatives discussed (e.g., Any becoming a typealias for any Value and AnyObject becoming a typealias for any Object ). However, the proposal will be amended to remove the warning about any Any and any AnyObject .

Thank you to everyone who participated in the review and pitches!

Doug Gregor
Review Manager

53 Likes
Terms of Service

Privacy Policy

Cookie Policy