[swift-evolution] ed/ing, InPlace, Set/SetAlgebra naming resolution
clattner at apple.com
Fri Feb 12 11:20:51 CST 2016
On Feb 11, 2016, at 11:26 PM, Greg Parker via swift-evolution <swift-evolution at swift.org> wrote:
> 3. Add a new operator .= for in-place modification, to shorten the "expr = expr.method()" case.
.= doesn’t really make sense in the context of Swift. Proposal’s like the (obsolete and unlikely to happen) inplace proposal work by making the = part of the name. This is important because methods (including the in place assignment operations) should be curryable.
IOW, the Equal is part of the name of the method, it isn’t part of the “operation of calling the method”.
That said, as Dave mentioned before, we discussed this extensively in the Swift 2 timeframe because it introduces yet-another concept very similar but different to the existing “mutating” keyword, and doesn’t have obvious semantics for classes. After trying very hard to make something like it work, we agreed that it was better to put the complexity of this back into the space of naming, rather than adding confusing new language features.
More information about the swift-evolution