<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 14.05.2016 um 17:52 schrieb Tony Allevato via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 2016-05-10 18:51:29 +0000, Chris Lattner via swift-evolution said:<br class=""><br class=""><blockquote type="cite" class="">Hello Swift community,<br class="">The review of "SE-0081: Move where clause to end of declaration" begins now and runs through May 16. The proposal is available here:<br class=""> <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0081-move-where-expression.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0081-move-where-expression.md</a> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">or, if you would like to keep your feedback private, directly to the review manager.<br class="">What goes into a review?<br class="">The goal of the review process is to improve the proposal under review through constructive criticism and contribute to the direction of Swift. When writing your review, here are some questions you might want to answer in your review:<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* What is your evaluation of the proposal?<br class=""></blockquote><br class="">-1. My thoughts essentially mirror those of Jon Shier, Karl Wagner, and Nicola Salmoria.<br class=""><br class="">To me, this makes declarations with complex sets of constraints much harder to read, because I have to hunt them down instead of finding them all in one place. Under this proposal, the longer an argument list gets, the further separated the constraints are from the type parameters that use them.<br class=""><br class="">This solution also obfuscates function definitions. Having the function's return type be the very last thing in the header line is has very nice readability benefit, and this proposal takes that away by sandwiching the return type awkwardly in the middle.<br class=""></div></div></blockquote><div><br class=""></div>IMO the readability is improved because the where clause can be easily placed in a new line. Generic function definitions with where clauses typically are too long for being crammed into one line without having the readability suffer. The proposal allows a much more readable splitting of the definition into several lines. This completely alleviates the problem of separating generic type information or sandwiching the return type, because the where clause in the next line will be near the generic type parameter list again.</div><div>Taking Jon Shier’s example:&nbsp;</div><div>The following definition is already too long IMO. The current syntax does not allow nice splitting of the line and readability suffers from the long gap between the function name and its parameter list:</div><div><span style="font-family: Menlo;" class="">&nbsp; &nbsp; func something&lt;T: Decodable</span><span style="font-family: Menlo;" class="">&nbsp;</span><span style="font-family: Menlo;" class="">where T == T.DecodedType</span><span style="font-family: Menlo;" class="">&gt;(with something: T) -&gt; String</span></div><div><br class=""></div><div>instead of writing a long line with sandwiching problems like that:</div><div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""></div></div></div></div><div><span style="font-family: Menlo;" class="">&nbsp; &nbsp; func something&lt;T: Decodable&gt;(with something: T) -&gt; String where T == T.DecodedType</span></div><div><br class=""></div><div>I would write:</div><div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><font face="Menlo" class="">&nbsp; &nbsp; func something&lt;T: Decodable&gt;(with something: T) -&gt; String&nbsp;</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; &nbsp; &nbsp; where T == T.DecodedType</font></div></div></div></div></div><div><br class=""></div><div><div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><font face="Menlo" class=""><br class=""></font></div></div></div></div></div></div><div>To recap: I think that readability improves with the proposal for the following reasons:</div><div>- The gap between the function name and its parameter list is reduced</div><div>- Definitions with where clauses typically are already too long to readably fit into one line, so they should be split over more than one line. The current syntax does not offer a natural position for a line break (breaking before the where even further increases the gap between the function name and its parameter list and it looks ugly because of the angle brackets being on separate lines.</div><div><br class=""></div><div>-Thorsten</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">The admission that some constraints should be allowed inside the angle brackets (conformance constraints) while moving others (associated type constraints) out introduces inconsistency in the language and seems like an incomplete fix. From a teaching point of view, I would find it more difficult to explain to users of the language "constraints that look like *this* go here, but constraints that look like *that* go way over there". The current model of "all generic constraints go between &lt; and &gt;" is clean and simple.<br class=""><br class="">Lastly, from a bit of a pedantic point of view, moving the where-clause to the end of a function declaration makes it look like the function is satisfying some constraints, when it's actually the generic type parameters that are satisfying them. In that sense, it's better to keep them closer together.<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* Is the problem being addressed significant enough to warrant a change to Swift?<br class=""></blockquote><br class="">Yes, but not in this fashion. I agree with some of the other sentiment that there should be better ways of satisfying complex constraint sets (through generic typealiases or something else) to clean them up, but moving the where-clause creates more readability problems than it solves.<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* Does this proposal fit well with the feel and direction of Swift?<br class=""></blockquote><br class="">I don't believe so; it adds inconsistency rather than removes it.<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class=""></blockquote><br class="">No languages that allow generics to be expressed so richly as Swift's.<br class=""><br class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""></blockquote><br class="">Read the proposal and followed the mailing list threads.<br class=""><br class=""><blockquote type="cite" class="">More information about the Swift evolution process is available at<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/apple/swift-evolution/blob/master/process.md" class="">https://github.com/apple/swift-evolution/blob/master/process.md</a><br class="">Thank you,<br class="">-Chris Lattner<br class="">Review Manager<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class="">swift-evolution@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></blockquote><br class=""><br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></body></html>