[swift-evolution] [SE-0088] Dispatch API names

Adrian Zubarev 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)


-- 
Adrian Zubarev
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.

--  
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution at swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160621/47091986/attachment.html>


More information about the swift-evolution mailing list