[swift-evolution] ed/ing, InPlace, Set/SetAlgebra naming resolution

David Owens II david at owensd.io
Fri Feb 12 00:33:30 CST 2016


> On Feb 11, 2016, at 10:30 PM, Chris Lattner <clattner at apple.com> wrote:
> 
> 
>> On Feb 11, 2016, at 10:28 PM, David Owens II via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I don’t know if this has been suggested already… but why not just use the same name and have an `inPlace` parameter with a default value?
> 
> inplace, or not, fundamentally affects the operation, including the return type.  On a struct, it is the different between the method being mutating or not.
> 
> -Chris

The return type is not always different, but in the case where it is and when we need mutating, can’t overloads solve this problem?

mutating func sort() {}
func sort(inPlace: Bool) -> T {}

Maybe I’m just overlooking something really obvious here…

-David


More information about the swift-evolution mailing list