[swift-evolution] SetAlgebra naming update
Dave Abrahams
dabrahams at apple.com
Thu Mar 24 19:19:35 CDT 2016
on Thu Mar 24 2016, Erica Sadun <swift-evolution at swift.org> wrote:
>>
>> On Mar 24, 2016, at 2:39 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>>
>>
>> Just an update:
>
>>
>> The naming guidelines working group went back into negotiation over
>> the shape of SetAlgebra (and thus, Set and OptionSet) for
>> Swift 3, and reached a new consensus. We intend to bring forward a
>> proposal for the API shown here:
>>
>> http://dabrahams.github.io/swift-naming/SetAlgebra-Math.html
>>
>> and to update the guidelines to suggest using the "form" prefix to
>> create a verb phrase for a mutating method when the operation is
>> fundamentally non-mutating and described by a noun.
>
> I've got to say, I expected to hate this until I clicked the link and saw the actual
> proposed syntax. For the most part, it's good: clear and readable.
>
> Not a fan of "subtracting" (would prefer "bySubtracting"). Other than that
> really impressed by how this evolved.
x by subtracting y
means, “give me x, and get it by subtracting y.” The use of “byXXXing”
in existing Cocoa APIs doesn't really set a precedent because it was
always preceded by a noun that described the result being returned,
e.g. “x.stringByAppending(y),” which is a completely different thing.
--
Dave
More information about the swift-evolution
mailing list