[swift-evolution] Optional assignment operator

Chris Lattner clattner at apple.com
Thu May 12 17:12:29 CDT 2016

> On May 12, 2016, at 2:38 PM, Tod Cunningham via swift-evolution <swift-evolution at swift.org> wrote:
> I ended up creating a ??= operator about a month ago to do something very similar.  It’s a shame it won’t be made part of the official library.  Although, it is very easy to add.
> Just like the ?? operator the default value is only evaluated if the optional in nil.  However, unlike ?? it will
> change the optional to be equal to the value on the right, iff the optional was nil.

We formally discussed & rejected this already:


More information about the swift-evolution mailing list