<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">I’ve been a little dismayed to see that closures in Swift 3 no longer have parameter names. As an example, in Swift 2, a function with a completion block may look like this:</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">func sendMessage(completion: (success: Bool, recipientID: String?, senderID: String?) -> Void) {</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"> //Oh no it failed</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"> completion(success: false, recipientID: nil, senderID: nil)</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">}</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Now, in Swift 3, it looks like this:</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">func sendMessage(completion: @escaping (_ success: String, _ recipientID: String?, _ senderID: String?) -> Void {</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"> //Oh no it failed</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"> completion(false, nil, nil)</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">}</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">So now all parameter names, if you wish to include them, must be preceded by a _. Removing the _, it forces you to put it back. Or putting the parameter name twice, it forces you to replace the first occurrence with a _.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">To me, one of the great advantages of Swift over a language like Python or Ruby is its self-documenting nature. If I’m calling a function, I don’t need to look elsewhere for a reference to the parameters I’m using. When reading back over my code, I don’t have to look elsewhere to check whether I used the correct parameters, and in the correct order. In Swift 2, I can easily glance at my code to check its correctness, and I can clearly see I’m responding to the completion block correctly. In Swift 3, I need to look elsewhere to see what the parameters in “(false, nil, nil)" refers to, and that negates one of the key advantages that Swift has.</div><div id="bloop_sign_1475922428883325184" class="bloop_sign"><br></div><div id="bloop_sign_1475922428883325184" class="bloop_sign">For this kind of closure, I feel like it’s almost required that we be able to have parameter names. My request is that if we list the parameter names explicitly, like in the Swift 2 example, then they appear in the closure call by default.</div></body></html>