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

Goffredo Marocchi panajev at gmail.com
Wed Jun 22 03:39:47 CDT 2016


Sorry, but can you explain why the character used to   escape   strings is also the best choice to do   Variable value extraction/String interpolation?  They are two different concepts.

Sent from my iPhone

On 22 Jun 2016, at 09:28, Charlie Monroe via swift-evolution <swift-evolution at swift.org> wrote:

>> 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.
> 
> Exactly. And on some other keyboards, $ is not easily accessible either. There will never be a universal character that's easily accessible on all keyboards. \ is already used for escaping  characters in a string, which makes it logical.
> 
>> 
>> -Michael
>> 
>>> 
>>> -- 
>>> Dave
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> 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