[swift-evolution] [Discussion] Default Closure Arguments

T.J. Usiyan griotspeak at gmail.com
Tue Jun 14 10:34:51 CDT 2016


What would this help you express? It is fairly difficult to read the type
and understand your motivation from this reduced example. It is clear what
you want but not what it wins you or us.

On Tue, Jun 14, 2016 at 3:40 AM, Andrew Bennett via swift-evolution <
swift-evolution at swift.org> wrote:

> I'd like to be able to do this:
>
> func callSomething(callback: (test: (arg: Int = 4) -> Void) -> Void) {
>
>   callback(test: { print($0) })
>
> }
>
>
> callSomething { test in
>
>   test()
>
> }
>
>
>
> Ideally the default argument would be part of the closure's type signature.
>
> If-not then it could be part of callSomething's signature, and it could
> lose the defaulted arguments if passed around.
>
> What do you think?
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160614/9ad66661/attachment.html>


More information about the swift-evolution mailing list