[swift-evolution] [SHORT Review] SE-0132: Rationalizing Sequence end-operation names
saagarjha28 at gmail.com
Mon Jul 25 23:25:19 CDT 2016
There’s remove, which is mutating in that it actually removes the elements from the target. removing, on the other hand is nonmutating and basically gives a copy and then removes from the copy.
> On Jul 25, 2016, at 21:21, Boris Wang via swift-evolution <swift-evolution at swift.org> wrote:
> "When the operation is naturally described by a verb, use the verb’s imperative for the mutating method and apply the “ed” or “ing” suffix to name its nonmutating counterpart."
> I known it. But, the "verb" here should be a action will change the object. Not every verb will change the object.
> Like the word: peek ,copy.
> In socket program, there's a action "peek", just check if there has new data in socket data buffer, not move out the data(like the API receive()). It's not "receiving".
> Daniel Duan <daniel at duan.org <mailto:daniel at duan.org>>于2016年7月26日 周二11:39写道：
> Please read the naming section in Swift API design guidelines https://swift.org/documentation/api-design-guidelines/#naming <https://swift.org/documentation/api-design-guidelines/#naming>
> Daniel Duan
> Sent from my iPhone
> On Jul 25, 2016, at 8:29 PM, Boris Wang via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> I am curious about the reason using "removing",
>> What we are doing is not remove, just selecting some elements from the original collection.
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution