[swift-evolution] Brace syntax

Michael Buckley michael at buckleyisms.com
Sun Dec 20 14:47:06 CST 2015


On Sun, Dec 20, 2015 at 12:33 PM, Andrey Tarantsov <andrey at tarantsov.com>
wrote:

> 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.


Yeah, good point. But since I'm writing Swift code, I'm going to use Xcode.
And with apologies to users of other editors, I suspect 99% of swift code
will be written in Xcode, so it's probably worth considering how Xcode will
deal with copy-paste.

But for Python, I could use a different editor.

As for why I would accept such poorly-formatted code, the exact scenario
I'm thinking of happened a few years ago. A colleague went on vacation and
realized one of the functions he had written had a bad bug in it. He
couldn't get into the corporate network over VPN from his remote location,
so he emailed me what the function should actually be and then disconnected
himself from the Internet for a week. The problem was whatever email system
he used to send the code mangled the indentation. It was quite an
impressive feat.

I suspect the more common use case is people copying and pasting
poorly-formatted code off Stack Overflow.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151220/8ee0a4a3/attachment.html>


More information about the swift-evolution mailing list