[swift-evolution] Brace syntax

Radosław Pietruszewski radexpl at gmail.com
Sun Dec 20 14:43:38 CST 2015


Honestly? Who cares? This doesn’t seem like a reasonable conversation to have, especially 1.5 years into Swift’s existence.

Having done a lot of work in Objective C (C-style braces), Ruby (newline, end), and CoffeeScript (significant whitespace), I couldn’t be less bothered with Swift’s choice of curly braces.

To me, the problem with C-style syntax are things like unnecessary parentheses and semicolons. Swift has neither of those. Comparing {} and Ruby style, I could go either way, it doesn’t really matter. Ruby is hardly less characters, just different and less symbols. Also has advantage that {} in blocks is separate from scoping. OTOH, symbolic {} is easier to discern and very clearly shows scopes.

Significant whitespace is very neat, but many a times I was confused by it, and made a mistake, or was close to making a mistake, because scopes just weren’t clearly defined enough. I like it, but I can definitely see downsides.

</bikeshed>

— Radek

> On 20 Dec 2015, at 02:39, Alexander Regueiro via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 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.
> 
> Thoughts?
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list