I think this is the same proposal as this rejected proposal: https://github.com/apple/swift-evolution/blob/master/proposals/0024-optional-value-setter.md <https://github.com/apple/swift-evolution/blob/master/proposals/0024-optional-value-setter.md>
> Le 25 janv. 2017 à 08:56, Sean Heber via swift-evolution > <swift-evolution@swift.org> a écrit : > > Seems trivial to do this now: > > var foo = someOptional ?? foo > > Unless I’m not understanding? > > l8r > Sean > > >> On Jan 25, 2017, at 10:40 AM, Nichi Shin via swift-evolution >> <swift-evolution@swift.org> wrote: >> >> I’d like to propose a new operator for optional assignment in Swift. >> >> The idea is that by using this operator (e.g. by doing a ?= b), the optional >> on the right would be assigned to the variable on the left only when it has >> something to assign (i.e. when it's not nil). >> >> The implementation could be something as follows: >> >> /// Optional Assignment Operator >> infix operator ?=: AssignmentPrecedence >> >> func ?=<T>(left: inout T, right: T?) { >> if right != nil { >> left = right! >> } >> } >> >> func ?=<T>(left: inout T?, right: T?) { >> if right != nil { >> left = right >> } >> } >> >> I hope you will consider adding this on a future release of this great >> programming language. >> >> Kind regards, >> N. S. >> _______________________________________________ >> 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