Re: [swift-evolution] Argument labels in callbacks

2017-02-22 Thread Derrick Ho via swift-evolution
Argument labels on blocks arguments should be brought back. On Wed, Feb 22, 2017 at 4:26 AM Franklin Schrans via swift-evolution < swift-evolution@swift.org> wrote: > I don’t see why it should be available in function arguments. > > The separation of the type and its label makes sense semantical

Re: [swift-evolution] Argument labels in callbacks

2017-02-22 Thread Franklin Schrans via swift-evolution
I don’t see why it should be available in function arguments. The separation of the type and its label makes sense semantically, but the syntax doesn’t look as pretty anymore. Writing something like foo(completion(success:error:): (Bool, Error) -> Void) {} seems a bit convoluted to me. We fi

Re: [swift-evolution] Argument labels in callbacks

2017-02-22 Thread Iain Smith via swift-evolution
Would this proposed syntax, using argument labels, also be available in function arguments? e.g func items(withCompletion completion(success:error:): ([Item]?, NSError?) -> Void) { ... completion(success: items, error:nil) } > On 22 Feb 2017, at 08:49, Charlie Monroe via swift-evolution

Re: [swift-evolution] Argument labels in callbacks

2017-02-22 Thread Goffredo Marocchi via swift-evolution
I remember it and remember the disagreements over this simplification too, but I really hope this is now not skipping a full year again. Sent from my iPhone > On 22 Feb 2017, at 08:49, Charlie Monroe wrote: > > This was pointed out during the discussions surrounding this proposal and it > was

Re: [swift-evolution] Argument labels in callbacks

2017-02-22 Thread Charlie Monroe via swift-evolution
This was pointed out during the discussions surrounding this proposal and it was agreed that the type simplification was important. There were several suggestions how to bring this back using different features - e.g. compound names that would contain the labels. For example: let callback(succe

Re: [swift-evolution] Argument labels in callbacks

2017-02-22 Thread Goffredo Marocchi via swift-evolution
I am quite interested in this as well, thanks for bringing it up! It was quite disappointing to fall back to multi argument method calls without labels as it was going against the emphasis on the value of labels in the language as well as decreasing readability of what is supposed to be self doc

[swift-evolution] Argument labels in callbacks

2017-02-22 Thread Franklin Schrans via swift-evolution
Hi, When SE-0111 was approved, I noticed the implication it had when using closures as callbacks: Writing func foo(completion: (success: Bool) -> Void) { completion(success: true