[swift-evolution] Thoughts on replacing \() with $() or some other symbol

Michael Peternell michael.peternell at gmx.at
Wed Jun 22 02:02:26 CDT 2016

> Am 22.06.2016 um 02:11 schrieb Dave Abrahams via swift-evolution <swift-evolution at swift.org>:
> on Tue Jun 21 2016, Brandon Knope <swift-evolution at swift.org> wrote:
>> Maybe this is flawed, but I think it is hard to argue that the \ is
>> easy to type when there are far more usable alternatives.
> While I agree with you, readability is *so* much more important than
> typeability that I think this line of argument doesn't count for much.

I agree. As a user of a German keyboard, "\" is written as Alt-Shift-7 (there isn't even a label on the keyboard, you just have to know this. The "7" key says "7" and "/" - I'm talking about the German Mac Keyboard, the standalone version of the Mac Mini and the Notebook Version of Macbook Air/Pro are the same in this regard.), and "$" is written as Shift-4. "$" is used in languages were "$" is used as a sigil for variables. It makes sense there to allow these variables directly in some strings. But not so in Swift. What I like about "\" is that it is a compatible extension to string literals, as much as possible. Strings that were valid and sensible before are still valid and sensible and mean the same thing. You can copy&paste a C string literal into Swift, and it will have the same meaning, because C strings do not contain `\(`.

I'm already used to using Alt- and Alt-Shift combinations anyway, they are just needed everywhere. Can use them for „German typographical quotes“ (Alt-^, Alt-2), “English typographical quotes” (Alt-Shift-^, Alt-Shift-2), 2 ≤ 4 comparisons, etc. E.g. the "[]" are Alt-5 and Alt-6.

That said, there is a programming co-worker of mine that uses an English keyboard, because he says it's easier to write code there. That's actually something that many non-English programmers do right now.


> -- 
> Dave

More information about the swift-evolution mailing list