[swift-evolution] [Accepted] SE-0111: Remove type system significance of function argument labels

David Owens II david at owensd.io
Mon Jul 11 01:19:56 CDT 2016

> On Jul 10, 2016, at 11:09 PM, Mark Lacey <mark.lacey at apple.com> wrote:
> In the meantime one option here would be to define a nested function that invokes the callback. It results in boilerplate, which is unfortunate, but would work:
> func doResize
> (
>   image: Image,
>   completed completedParam: (original: Image, resized: Image) -> Void
> ) {
>   func completed(original: Image, resized: Image) {
>     completedParam(original, resized)
>   }
>   // do lots of work
>   completed(original: image, resized: Image(data: newData, size: newSize))
> }

That doesn’t solve anything; you still have to write the nested function, which means you still need to know what the order is. That’s only going to come through the documentation or non-compiler verified labels.

It also doesn’t help the call site for `doResize` - you’ll still get the non-descript `(Image, Image)` values.


More information about the swift-evolution mailing list