> On Jul 10, 2016, at 11:09 PM, Mark Lacey <[email protected]> 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.

-David

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to