[swift-evolution] Brace syntax

Alexander Regueiro alexreg at gmail.com
Sun Dec 20 14:36:26 CST 2015


How can we find out if the core team is willing to consider this? Do we know their original rationale for choosing braces? The reason I proposed this in the first place was because I suspected they’d just chosen them by default (given that Swift was inspired to large extends by Objective C and C#).

> On 20 Dec 2015, at 20:33, Andrey Tarantsov <andrey at tarantsov.com> wrote:
> 
> We're really wasting time here (I'm pretty sure that the core team isn't considering the possibility), but:
> 
>> You could try to prevent this is Swift by banning the use of either tabs or spaces in indentation. But this would put you in the middle of a holy war [...]
> 
> Go does just that, with great profit.
> 
> (gofmt turns all indentation into tabs, although I would argue that a better approach is to ban tabs and only ever allow spaces)
> 
>> Critics of [braces] tend to focus on the fact that they don't express anything not already expressed by indentation. But as I've explained here, that's not quite true. They provide enough context to text editors to automatically format your code for you. Without them, text editors cannot perform certain formatting operations.
> 
> 
> Your whole point is that indentation sometimes gets lost on copy/paste, and braces don't. But it's a strange argument. Why would you use an editor or email program that routinely loses your data (indentation in this case)? Why would you copy your code from a strange web page whose author didn't even bother to format it correctly?
> 
> It sounds like you're not using per-line copy/paste features in your editor, and you need to change your editor or editing habits.
> 
> But I take the resulting broader point: indentation-based editing skills are a bit harder to master.
> 
>> Python on the other hand, is vulnerable to this kind of bug due to unintentional outdenting.
> 
> This is actually true. I've experienced this in Python a few times. Second valid point, I suppose, although it has never been a problem to catch it in practice.
> 
> A.
> 



More information about the swift-evolution mailing list