<div dir="ltr">On Fri, Jun 24, 2016 at 2:26 PM, Charlie Monroe <span dir="ltr"><<a href="mailto:charlie@charliemonroe.net" target="_blank">charlie@charliemonroe.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Jun 24, 2016, at 9:00 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div dir="ltr">On Fri, Jun 24, 2016 at 1:56 PM, Sean Heber <span dir="ltr"><<a href="mailto:sean@fifthace.com" target="_blank">sean@fifthace.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>> On Jun 24, 2016, at 1:30 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
><br>
> On Fri, Jun 24, 2016 at 6:37 AM, William Shipley <<a href="mailto:wjs@mac.com" target="_blank">wjs@mac.com</a>> wrote:<br>
> On Jun 23, 2016, at 11:04 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br>
>><br>
>> Not a practitioner of 80-character line limits, I take it?<br>
><br>
> I don’t understand why anyone wouldn’t just let Xcode do the wrapping for most cases. I’ll add newlines if I think it adds to clarity, but in general I don’t want to code like i’m still on a Wyse WY-50.<br>
><br>
> Of course, to each their own style--I certainly wouldn't want Swift to force everyone to write lines of certain lengths. But 80-character lines is a common style, and I would say that a corollary of "to each their own" is that Swift's grammar should be usable and useful whether or not you adhere to such style choices.<br>
<br>
</span>I honestly don’t believe that this a common style in the Cocoa community.</blockquote><div><br></div><div>We're talking about the Swift community here, and Swift stdlib would be a good starting point as to what is a common or at least accepted style; it uses 80-character lines.</div></div></div></div></div></blockquote><div><br></div></span><div>While it does, it makes sense only for readability purposes of the documentation. For example, I see absolute no reason why to split <a href="https://github.com/apple/swift/blob/master/stdlib/public/core/StringBuffer.swift#L233" target="_blank">https://github.com/apple/swift/blob/master/stdlib/public/core/StringBuffer.swift#L233</a> into two lines.</div><div><br></div><div>It makes the code less readable.</div><div><br></div><div>80-char style made sense in C, where everything is pretty much top-level. But given that you declare a class, within which you declare another class, within which you declare methods, the first level of the method indentation is at level 3, which given 4 spaces per tab gives you 12 characters already. Adding a few levels (for-cycle + an if statement within the for cycle) gives you 20 characters of just whitespace (1/4 of the allocated 80 chars per line).</div><div><br></div><div>Which is why I don't believe this code style is valid in a modern language.</div></div></div></blockquote><div><br></div><div>This is one style that some very intelligent people use in Swift. I'm not going to debate what styles are "valid."</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>My personal guess is that it should be upped to e.g. 160 chars per line - that kind of makes sense. There is no particular reason other than historic why we're still using 80 chars per line.</div><br><blockquote type="cite"><div><span class=""><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I’m not a member of the “old guard” having only come into this world 10 years ago with the iPhone, but just take a look at this delegate method in Objective-C:<br>
<br>
- (void)locationManager:(CLLocationManager *)manager rangingBeaconsDidFailForRegion:(CLBeaconRegion *)region withError:(NSError *)error;<br>
<br>
That’s well over 80 characters all by itself. This fits on my screen in a single line - and I work on a 15” MBP with room for my dock always visible on the side along with Xcode’s sidebar open! On a typical desktop-sized screen, 80-col lines must be comically short.<br>
<br>
I don’t know why it should be assumed that people are adhering to a so-called standard that dates back to terminal screens that didn’t have color.<br>
<span><br>
<br>
> If the chief advantage of `where` is that it (quoting someone above) allows one to "understand as much as possible about the control flow of the loop from a single line of code," then we ought perhaps to question its appropriateness when the majority of its benefits [by which I mean, based on your examples and Sean's, more than half of the instances in which it is used] cannot be realized in a very common coding style.<br>
<br>
</span>Again, I dispute the idea (having no data but my own :P) that 80-col limits are common in this community.<br>
<br>
l8r<br>
<span><font color="#888888">Sean<br>
<br>
</font></span></blockquote></div><br></div></div></span><span class="">
_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></div></blockquote></div><br></div></blockquote></div><br></div></div>