[swift-evolution] Pitch: Remove default initialization of optional bindings
Mike Kluev
mike.kluev at gmail.com
Wed Nov 8 08:51:01 CST 2017
on Mon, 06 Nov 2017 14:33:44 -0800 Slava Pestov <spestov at apple.com> 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.
>
value types only or classes as well?
i use the first form (and rely on it every here and there) and to me having
to set to nil explicitly will amount to more visual noise in the source.
btw, what is "the surface area of the language"?
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171108/08415308/attachment.html>
More information about the swift-evolution
mailing list