[swift-evolution] Revise GCD API to conform to API Design Guidelines
scott.gardner at mac.com
Sat Feb 13 09:48:28 CST 2016
I would like to submit the following rough sketch of a proposal to revise the GCD API syntax to adhere to the API Design Guidelines, in order to gauge interest and collect feedback and suggestions.
Here is a preliminary proposal outline:
Author: Scott Gardner
I propose that the Grand Central Dispatch (GCD) API be revised. GCD function signatures use snake-casing and are devoid of parameter names. This syntax does not conform to the Swift API Design Guidelines (“API guidelines”).
The GCD API provides a rich set of capabilities for writing concurrent code. Yet GCD’s syntax can be a barrier to entry for developers, because it does not conform to the API guidelines.
I propose revising the GCD API to follow the API guidelines. For example, instead of writing the following code to execute an operation asynchronously and then return to the main queue, such as to update the UI...
let concurrentQueue = dispatch_queue_create("com.scotteg.concurrent", DISPATCH_QUEUE_CONCURRENT)
…this should be able to written in a more Swifty manner, e.g.,...
let concurrentQueue = GCDQueue(.Concurrent, withIdentifier: "com.scotteg.concurrent")
Impact on existing code
This would be a wholesale replacement of syntax for the GCD API. A utility should also be created to convert pre-existing GCD code to the new syntax.
I would really appreciate your comments and suggestions, and I'd certainly be willing and committed to completing this proposal based on community feedback.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution