<div dir="ltr"><div>Andrey's post encourages me to veer into the merits of significant whitespace vs braces. This is probably unwise of me, since we're not all going to agree any time soon, but I can't resist pointing out an example:</div><div><br></div><div>////////////////////////////////////////////////////////////////////////<br></div><div><br></div><div><div>var foo: Int </div><div>{</div><div> get </div><div> { </div><div> return _foo</div><div> }</div><div> set </div><div> {</div><div> _foo = newValue</div><div> }</div><div>}</div><div><br></div></div><div><div><div>////////////////////////////////////////////////////////////////////////<br></div></div></div><div><br></div><div><div>var foo: Int:</div><div> get: </div><div> return _foo</div><div> set:<br></div><div> _foo = newValue</div><div><br></div></div><div><div>////////////////////////////////////////////////////////////////////////<br></div></div><div><br></div><div>It's obvious no programmer is going to be consistent about braces in the first example - it's absurdly verbose. So with braces in Swift, pretty much everything you write carries the overhead of "what inconsistent way will i format the braces for this code?" For me, I'd rather throw out the (largely redundant) noise, and stick with just the content.</div><div><br></div><div><br></div><div> </div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 20, 2015 at 3:59 AM, Andrey Tarantsov via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><blockquote type="cite"><div><div dir="ltr"><div>I don't know many people who have experienced a large variety (8+?) of programming languages and prefer Python's forced indentation</div></div></div></blockquote><div><br></div></span><div>Count me as one. I'd prefer Swift to have Python-style indentation, just on the grounds of braces being stupid (why would you want to enter the same scope information <i>twice</i>)?</div><div><br></div><div>So +1 from me, although I don't suffer from the braces at all.</div><div><br></div><div>I do want to point out that the amount of code that fits on a screen <b>is</b><i> </i>fairly important, and you should keep your methods short, so one less brace per method means a couple more methods per screen.</div><div><br></div><div>This would also free up braces to mean “closure” in 100% of cases, which is good for consistency.</div><div><br></div><div>But it would introduce it's share of problems for sure, so I don't feel strongly about this proposal.</div><div><br></div><div>I also admit that braces are generally preferred, for some mysterious reason that I hope a believer can articulate here. Take Sass, for example; it has both an indentation-based syntax and a braces-based syntax, and the latter one seems way more popular.</div><div><br></div><div>A.</div><div><br></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=l3fs1g-2F466j3y5fD5Q61KddsTTCmXL0uxw3XoAMFFNjs1zLdXswAEplDZrmAtIc0LqzCipvOLyzgkbwiVVjPWAdARS5Nq9xO-2FuLvouA90AbYrN5ZDG2be7eORfL9ScUgPSW5c3ynPZAMgKyql9niOLwkBMEyIhl-2B4Xn6C0QoY6v-2FgQ1t4hKfKjA19n9FBktkRj5M6fzABGCxjAvSake1mJe1ziPkbzqcUKwMOL2bwSE-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>