[swift-evolution] Pitch: @required attribute for closures
michael.peternell at gmx.at
Mon Jun 6 14:49:07 CDT 2016
> Am 06.06.2016 um 00:59 schrieb Charles Srstka <cocoadev at charlessoft.com>:
>> On Jun 5, 2016, at 5:46 PM, michael.peternell at gmx.at wrote:
>>> Am 05.06.2016 um 20:31 schrieb Charlie Monroe via swift-evolution <swift-evolution at swift.org>:
>>> While I agree with Michael that nowadays, a lot of stuff that doesn't need to be, is done async, which leads to a giant thread pool per app and developers nowadays do not think of the cost of inter-thread communication (i.e. each dispatch_(a)sync has its cost, even though it's a light-weight thread), I agree with Charles that something like suggested does indeed help debugging issues with multi-thread apps.
>> I agree that it may help in a few cases. But I think the change is "not significant enough to warrant a change in Swift". It adds yet another keyword to the language that every new dev has to learn about, and the problem it solves can more elegantly be solved by writing more elegant code.
> Okay, what’s the “more elegant” way to write a function that uses networking or XPC, or that requires user feedback from a sheet?
That's really hard to answer in the general case. I think real proposals should contain concrete, realistic examples that show the benefit of the proposal. It's really hard to argue against a proposal if there is no such example. User feedback from a sheet is one of the few examples where asynchronous programming makes sense: But I cannot see how a `@required` annotation would be useful in that setting.
More information about the swift-evolution