[swift-evolution] [SE-0088] Dispatch API names
adrian.zubarev at devandartist.com
Tue Jun 21 03:24:08 CDT 2016
Just yesterday I filed a bug because Data and DispatchData overlap but the api is not consistent: https://bugs.swift.org/browse/SR–1843
I never used libdispatch in depth but wanted to learn how it works to evolve my TCP module.
At first glance I spotted one wrong label name on DispatchIO:
public class func write(fromFileDescriptor: Int32, data: DispatchData, runningHandlerOn queue: DispatchQueue, handler: (data: DispatchData?, error: Int32) -> Swift.Void)
This should look like (because we write TO a file):
public class func write(toFileDescriptor: Int32, data: DispatchData, runningHandlerOn queue: DispatchQueue, handler: (data: DispatchData?, error: Int32) -> Swift.Void)
Interesting thing is also that this wasn’t proposed that way at all:
class func write(fileDescriptor: Int32, data: DispatchData, queue: DispatchQueue, handler: (DispatchData?, Int32) -> Void)
Sent with Airmail
Am 21. Juni 2016 um 08:40:55, Brent Royal-Gordon via swift-evolution (swift-evolution at swift.org) schrieb:
> The guideline that methods should "read as imperative verb phrases" applies to the full name, labels and arguments and all, and not just the base name. You'll recall that the original proposal had .asynchronously(execute:), which is very much an imperative phrase. `.async(execute:)` was substituted by popular demand, with "async" being regarded as a term-of-art exception.
Right, I forgot about that. I had a vague feeling that `execute` was the verb, but the shortening obscured `async`'s role as an adverb.
swift-evolution mailing list
swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution