[swift-evolution] Pitch: Remove default initialization of optional bindings

Slava Pestov spestov at apple.com
Mon Nov 6 16:33:44 CST 2017


Hi all,

Right now, the following two declarations are equivalent:

struct S {
  var x: Int?
}

struct S {
  var x: Int? = nil
}

That is, mutable bindings of sugared optional type (but not Optional<T>!) always have a default value of ‘nil’. This feature increases the surface area of the language for no good reason, and I would like to deprecate it in -swift-version 5 with a short proposal. Does anyone feel strongly about giving it up? I suspect most Swift users don’t even know it exists.

Slava


More information about the swift-evolution mailing list