I used the existence of the first one in my explanation of explain optionals. "There is a reasonable default value for an optional type. 'nothing'."
TJ On Mon, Nov 6, 2017 at 6:52 PM, Slava Pestov via swift-evolution < swift-evolution@swift.org> wrote: > > > On Nov 6, 2017, at 4:29 PM, Kelvin Ma <kelvin1...@gmail.com> wrote: > > hot take: i use the second one a lot but only because i always forget the > first one exists. So I type the = nil just to “be sure”. > > > Yeah, that’s one of my arguments against having the feature, along with > the simple fact that if the language did not have it already, nobody would > be requesting this to be added as a special case for optionals. > > However, since I also want to avoid needless source compatibility churn, > I’m fine with keeping the feature — it’s not a huge burden to maintain > (unlike, say, AnyObject dispatch :) ) > > Slava > > > On Mon, Nov 6, 2017 at 4:33 PM, Slava Pestov via swift-evolution < > swift-evolution@swift.org> wrote: > >> 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 >> _______________________________________________ >> swift-evolution mailing list >> swift-evolution@swift.org >> https://lists.swift.org/mailman/listinfo/swift-evolution >> > > > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution > >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution