<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>on Tue, 21 Nov 2017 11:06:04 +0100 Tino Heth <<a href="mailto:2th@gmx.de">2th@gmx.de</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
> 5. func fn<T>[foo, bar](param: T) throws -> T where T: Equatable captures [foo, bar] { … }<br>
<br>
I guess it can be considered good practice to start a line with the most important information, and move the details to the far right, so that they don’t distract the hasty reader.<br>
I’m not sure if the capture list an example for this, but for good or worse, it didn’t draw much attention in another position either (the first „[foo, bar]“ that slipped through).<br>
<br>
That variant (func fn<T>[foo, bar](param: T)) is definitely my favorite, because it keeps a characteristic of closures (first the capture list, then the parameters), but doesn’t carry over the mingling of body and parameters that has to be done in closures.<br></blockquote><div><br></div><div><br></div><div>maybe this?</div><div><br></div><div><div>{</div><div> capture weak foo, loo, poo // "capture list", if present</div><div><div> capture unowned bar, baz, booz // shall be at the beginning</div></div><div><div> capture weak delegate = self.delegate! // before anything else</div></div><div><br></div><div> foo()<br></div><div> ...</div><div>}</div></div><div><br></div><div>compare to the current:<br></div><div>{</div><div> [</div><div> weak foo, weak loo, weak poo</div><div> unowned bar, unowned baz, unowned booz</div><div> weak delegate = self.delegate!</div><div> ] in</div><div><br></div><div> foo()</div><div> ...</div><div>}</div><div><br></div><div>a bit more explicit / expressive, looks like ordinary statements, and doesn't have that strange "in" at the end.</div><div><br></div><div>Mike</div><div><br></div></div><br></div></div>