<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="">I have done a bunch of Python programming and when programming in Python I don’t find the lack of braces to be a problem most of the time, except occasionally if cutting and pasting code from web pages (then it is a huge pain). <div class=""><br class=""></div><div class="">I think Swift has this right though. In my mind, braces indicate groupings of statements. Making the use of them mandatory, I believe is also the right choice to avoid ambiguity as to whether the else clause goes with the inner if or the outer. I believe this discipline is good in that it avoids errors which are hard to detect. Finally, this enforces a consistency across all teams (despite my voting against required self). Being able to use more expressions and fewer statements may quell some people who hate lots of braces. Shameless plug for my new proposal on the ternary thread :-) </div><div class=""><br class=""></div><div class="">Further the statements vs expressions where statements are contained in braces and expressions have parenthesis, i think helps to subtly reinforce the differences between the two forms. This is why in my opinion, making statements into expressions is not a good direction for Swift as has been done in other languages, like Ruby. It complicates the programming model. </div><div class=""><br class=""></div><div class="">I feel like there is a discussion coming up with this soon as to whether statements and expressions should remain separate in Swift or the two should be combined. Haskell and other functional programming languages have blurred this line, but is it a good thing? In my experience with the ternary thread this came up quite a bit. </div><div class=""><br class=""></div><div class="">- Paul </div><div><blockquote type="cite" class=""><div class="">On Dec 19, 2015, at 8:37 PM, Charles Constant via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">This entire thread is just beating dead horse. Having said that; why not allow braces for closures, and disallow them elsewhere? It doesn't seem like a deal-breaker, really. I don't think there's much to debate aside from this: some people worry that significant whitespace makes code more error-prone, and others feel the increased legibility makes it less error-prone.</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sat, Dec 19, 2015 at 5:58 PM, Kevin Ballard via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There is not in fact an emphasis on conciseness. This has been repeated many times by the swift team. Conciseness is not a goal of Swift, but expressiveness absolutely is. Braces are a well-understood and simple way to express the notion of a scope/closure. And FWIW removing braces means you have to come up with a completely different syntax for closures, because indentation does not suffice there.<br class="">
<br class="">
Also, "don't be like C" is not even remotely a goal of Swift. The Swift syntax is C-like in many respects. "Be like C" isn't a goal either of course, but when deciding between two alternatives that have no compelling arguments either way, picking the one that would be more familiar to Obj-C programmers is usually a good idea.<br class="">
<br class="">
-Kevin Ballard<br class="">
<div class="HOEnZb"><div class="h5"><br class="">
On Sat, Dec 19, 2015, at 05:39 PM, Alexander Regueiro via swift-evolution wrote:<br class="">
> Has anyone considered removing braces from the Swift language? The main alternative would be indentation-based scoping like in Python or Ruby. There already seems to be a general emphasis on conciseness, lack of redundancy, and a modern syntax. e.g. semicolons are not required for single-line statements; brackets have been removed from if/for/while expressions, compared to C-style syntax. So, why not go the whole way in breaking the C-style connection? The present syntax seems to be shunning C, but only slightly.<br class="">
><br class="">
> Thoughts?<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="">
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><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="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</div></div></blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=emrIhnP1hIf76Foxxv4NNJQX-2FWhcznESwKBSwD1MEwwRMKzS6b5TzokqTVEw64xWvnpdLrt6onn75fVRIoGizXglvor-2B8i5tXgfAvEDdlm65ZpZLfv9No0Hwe-2BvVJBnGk-2FiY8-2Bk15Bk4ab7rlU6aUYtNYjBpQCs1uTYnAD1iphBzZ8AoVkrgSUE7M9IPVI-2Fl8wZgwFGXjRoxEUFctRzQC5waMIZnvLcsVw4-2FJdxVjx4-3D" alt="" width="1" height="1" border="0" style="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;" 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></blockquote></div><br class=""></body></html>