Thoughts on replacing \() with $() or some other symbol

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Brandon

···

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Your heat map doesn’t test the usability of a key, it tests the frequency with which it was pressed. The fact that there was no coloured blob on the backslash key just means you don’t use it very often.

···

On 22 Jun 2016, at 16:41, Brandon Knope <bknope@me.com> wrote:

Brandon

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at https://www.patrick-wied.at/projects/heatmap-keyboard/

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

The situation is very different on an iPad. I don't think this argument is a good enough reason either. It will differ based on locale, accessibility technology, device, personal key shortcuts, etc.

l8r
Sean

···

Sent from my iPhone

On Jun 21, 2016, at 6:52 PM, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

You're going to be holding shift for the parens anyways so it might be easier to type instead of not pressing and then pressing shift

Brandon

Sent from my iPad

On Jun 21, 2016, at 7:47 PM, Andrey Fidrya <af@zabiyaka.com> wrote:

I think that introducing another escape character is not a good idea.
\() is consistent with \r \n etc.

And I'm not sure if $ is easier to type. '\' is a single keypress and is located
near Backspace & Enter.

$ is SHIFT+4 and is harder to type without looking at the keyboard.

Andrey

On 22 Jun 2016, at 02:25, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

How can it be unpersuasive? I can *show* you that keys that are easier to type/reach exist for a large majority of user’s.

I am not saying it is a good idea or not to replace \, but to pretend that there isn’t an inconvenience there is unfair when every other part of the language is put under a magnifying glass for the sake of grammar, newbie friendliness, or this or that, etc...

This is measurable…it just depends on whether it bothers people or not enough. Most other things are based on opinion, but this *can* be based on numbers and usability.
This is something used by everyone. The usability cost is there and it is real. Just because “well it is easy for me to type” does not mean that it is ideal. It also doesn’t mean that the current choice is the wrong choice either. But it still is important to discuss while we can.

And yes a keyboard IS only so big, but the range to that bigness can be pretty… big.

Also, $ is not the only option. There are still far easier keys to type than \.

Brandon

On Jun 21, 2016, at 7:15 PM, Xiaodi Wu <xiaodi.wu@gmail.com> wrote:

On Tue, Jun 21, 2016 at 6:08 PM, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:
Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

I'm rather unpersuaded by this line of argument. The keyboard is only so big; it's a stretch to say that any key is less than absolutely usable. Moreover, \ is next the delete key, which I presume you use frequently and find no difficulty in reaching.

You know what *is* unusable though? Try finding the $ key on an international keyboard.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:
> I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.
>
> I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

> A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

You're going to be holding shift for the parens anyways so it might be easier to type instead of not pressing and then pressing shift

Brandon

···

Sent from my iPad

On Jun 21, 2016, at 7:47 PM, Andrey Fidrya <af@zabiyaka.com> wrote:

I think that introducing another escape character is not a good idea.
\() is consistent with \r \n etc.

And I'm not sure if $ is easier to type. '\' is a single keypress and is located
near Backspace & Enter.

$ is SHIFT+4 and is harder to type without looking at the keyboard.

Andrey

On 22 Jun 2016, at 02:25, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

How can it be unpersuasive? I can *show* you that keys that are easier to type/reach exist for a large majority of user’s.

I am not saying it is a good idea or not to replace \, but to pretend that there isn’t an inconvenience there is unfair when every other part of the language is put under a magnifying glass for the sake of grammar, newbie friendliness, or this or that, etc...

This is measurable…it just depends on whether it bothers people or not enough. Most other things are based on opinion, but this *can* be based on numbers and usability.
This is something used by everyone. The usability cost is there and it is real. Just because “well it is easy for me to type” does not mean that it is ideal. It also doesn’t mean that the current choice is the wrong choice either. But it still is important to discuss while we can.

And yes a keyboard IS only so big, but the range to that bigness can be pretty… big.

Also, $ is not the only option. There are still far easier keys to type than \.

Brandon

On Jun 21, 2016, at 7:15 PM, Xiaodi Wu <xiaodi.wu@gmail.com> wrote:

On Tue, Jun 21, 2016 at 6:08 PM, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:
Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

I'm rather unpersuaded by this line of argument. The keyboard is only so big; it's a stretch to say that any key is less than absolutely usable. Moreover, \ is next the delete key, which I presume you use frequently and find no difficulty in reaching.

You know what *is* unusable though? Try finding the $ key on an international keyboard.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:
> I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.
>
> I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

> A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

I agree, but is this why \ was chosen?

Brandon

···

Sent from my iPad

On Jun 21, 2016, at 7:58 PM, Sean Heber <sean@fifthace.com> wrote:

The situation is very different on an iPad. I don't think this argument is a good enough reason either. It will differ based on locale, accessibility technology, device, personal key shortcuts, etc.

l8r
Sean

Sent from my iPhone

On Jun 21, 2016, at 6:52 PM, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

You're going to be holding shift for the parens anyways so it might be easier to type instead of not pressing and then pressing shift

Brandon

Sent from my iPad

On Jun 21, 2016, at 7:47 PM, Andrey Fidrya <af@zabiyaka.com> wrote:

I think that introducing another escape character is not a good idea.
\() is consistent with \r \n etc.

And I'm not sure if $ is easier to type. '\' is a single keypress and is located
near Backspace & Enter.

$ is SHIFT+4 and is harder to type without looking at the keyboard.

Andrey

On 22 Jun 2016, at 02:25, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

How can it be unpersuasive? I can *show* you that keys that are easier to type/reach exist for a large majority of user’s.

I am not saying it is a good idea or not to replace \, but to pretend that there isn’t an inconvenience there is unfair when every other part of the language is put under a magnifying glass for the sake of grammar, newbie friendliness, or this or that, etc...

This is measurable…it just depends on whether it bothers people or not enough. Most other things are based on opinion, but this *can* be based on numbers and usability.
This is something used by everyone. The usability cost is there and it is real. Just because “well it is easy for me to type” does not mean that it is ideal. It also doesn’t mean that the current choice is the wrong choice either. But it still is important to discuss while we can.

And yes a keyboard IS only so big, but the range to that bigness can be pretty… big.

Also, $ is not the only option. There are still far easier keys to type than \.

Brandon

On Jun 21, 2016, at 7:15 PM, Xiaodi Wu <xiaodi.wu@gmail.com> wrote:

On Tue, Jun 21, 2016 at 6:08 PM, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:
Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

I'm rather unpersuaded by this line of argument. The keyboard is only so big; it's a stretch to say that any key is less than absolutely usable. Moreover, \ is next the delete key, which I presume you use frequently and find no difficulty in reaching.

You know what *is* unusable though? Try finding the $ key on an international keyboard.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:
> I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.
>
> I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

> A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

The following two lines are equivalent:

  return "Value of foo is \(foo), have a nice day!"
  return "Value of foo is " + foo + "have a nice day!" // Assuming foo is a String already

So in a way you can think of \() as being a means of escaping from the string entirely. I find this more logical than the idea which other languages encourage which is that the variable is somehow embedded inside the string, which is why I actually really like having escape do this in Swift.

···

On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution <swift-evolution@swift.org> wrote:

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.

No it shows where your hand frequently is also

Brandon

···

On Jun 22, 2016, at 12:01 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 16:41, Brandon Knope <bknope@me.com> wrote:

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Your heat map doesn’t test the usability of a key, it tests the frequency with which it was pressed. The fact that there was no coloured blob on the backslash key just means you don’t use it very often.

Brandon

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

One could argue they are different concepts, but that would be prioritising absolute purity over simplicity and clarity.

The current \() method is simple, clear, and easy to type and read. It's also compatible with the use of \ as an escape character which is a huge plus. I don't think it makes sense to replace it with another character simply for absolute purity's sake, especially if such a substitution would introduce another character that would require escaping.

Sincerely,
João Pinheiro

···

On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution <swift-evolution@swift.org> wrote:

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.

No they are not.

Escape means nothing more than “stop interpreting characters literally for a bit and do something else”. It’s perfectly reasonable to think of \( … ) as a nothing more than a complicated escape sequence. I don’t think anybody has ever been confused by the fact that it happens at run time rather than compile time.

Furthermore, if you change the escape character you have to introduce another escape sequence fro the character you have just taken and “$", I would argue is a poor choice since it is probably reasonable common to find it used literally in strings (unlike “\").

···

On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution <swift-evolution@swift.org> wrote:

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.

No it shows where your hand frequently is also

And you don’t think there is a correlation between where the frequently pressed keys are and where your hands are? If you were needing to press the \ key a lot, there would be a hotspot over it. Then you could say “look, I need to press this key a lot and it’s miles away from the other hotspot”.

···

On 22 Jun 2016, at 17:02, Brandon Knope <bknope@me.com> wrote:

Brandon

On Jun 22, 2016, at 12:01 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 16:41, Brandon Knope <bknope@me.com> wrote:

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Your heat map doesn’t test the usability of a key, it tests the frequency with which it was pressed. The fact that there was no coloured blob on the backslash key just means you don’t use it very often.

Brandon

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

They are two different concepts in the same way that salami pizza and pizza funghi are two different concepts.

The unifying concept (the "pizza") is this: A string starts with a `"`, has some letters, and ends with `"`; the letters in between the quotes are taken as-is, except for sequences starting with a `\`: `\n` is new line, ..., `\(...)` is string interpolation, ..., and finally you need to do `\\` to include a literal backslash into the string. So there is just one character (the backslash) which can start a special sequence. My opinion: `\` is rightfully the pizza character, not just the salami character.

Sorry for the cheesy analogy ;) In the end, it's just a matter of personal preference. Both approaches are equally sound on a theoretical level. To me, it was surprising at first, that `\` is used for string interpolation. But in a good way.

I think Swift 3 is heading in the right direction, and many changes provide real value. But there are also many things that should not change, like string interpolation syntax, "@noreturn" or removing the bridging of Objective-C types. Keeping the good things is just as important as inventing new stuff. Only a well-considered approach will bring major improvements.

-Michael

···

Am 22.06.2016 um 10:39 schrieb Goffredo Marocchi <panajev@gmail.com>:

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.

The two have equivalent output (excluding the omission of “, “ which I assume was a typo), but go through different code paths. I believe the interpolation has more opportunities for memory optimization.

-DW

···

On Jun 22, 2016, at 4:19 AM, Haravikk via swift-evolution <swift-evolution@swift.org> wrote:

The following two lines are equivalent:

  return "Value of foo is \(foo), have a nice day!"
  return "Value of foo is " + foo + "have a nice day!" // Assuming foo is a String already

So in a way you can think of \() as being a means of escaping from the string entirely. I find this more logical than the idea which other languages encourage which is that the variable is somehow embedded inside the string, which is why I actually really like having escape do this in Swift.

So in a way you can think of \() as being a means of escaping from the string entirely. I find this more logical than the idea which other languages encourage which is that the variable is somehow embedded inside the string, which is why I actually really like having escape do this in Swift.

I guess it is only a matter of personal preference... I do find the opposite to hold true, I like to think about the variable and its expansion so to speak in the target string.

···

Sent from my iPhone

On 22 Jun 2016, at 11:19, Haravikk <swift-evolution@haravikk.me> wrote:

On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution <swift-evolution@swift.org> wrote:

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.

The following two lines are equivalent:

  return "Value of foo is \(foo), have a nice day!"
  return "Value of foo is " + foo + "have a nice day!" // Assuming foo is a String already

So in a way you can think of \() as being a means of escaping from the string entirely. I find this more logical than the idea which other languages encourage which is that the variable is somehow embedded inside the string, which is why I actually really like having escape do this in Swift.

I really don’t understand why we are wasting everyone’s time debating this.

Yes I think there is a correlation. Yes this is precisely why I posted the heat map.

Of course \ is not needed a lot, but when it is, *it is inconvenient for *some* people*. I am not making this up. You can cite several other users from this very thread.

I tried showing that it is quite distant on the keyboard from where the user’s hands rest. I tried showing that there are other keys at their finger tips where their hand is usually resting.

1. Do I know every international keyboard layout? No.
2. Are we pretending that \ was picked because it was easier for international users? If I am wrong, I would love to hear more…else let’s not pretend that \ was the optimal key for all.

Like I have said repeatedly…I don’t care if \ is removed. At this point we are wasting other people’s time. I have just tried to be a voice for those that find it awkward and inconvenient. I tried not to base this just on opinion but on some *evidence*, but apparently that isn’t sufficient enough for some.

Brandon

···

On Jun 22, 2016, at 12:20 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 17:02, Brandon Knope <bknope@me.com> wrote:

No it shows where your hand frequently is also

And you don’t think there is a correlation between where the frequently pressed keys are and where your hands are? If you were needing to press the \ key a lot, there would be a hotspot over it. Then you could say “look, I need to press this key a lot and it’s miles away from the other hotspot”.

Brandon

On Jun 22, 2016, at 12:01 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 16:41, Brandon Knope <bknope@me.com> wrote:

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Your heat map doesn’t test the usability of a key, it tests the frequency with which it was pressed. The fact that there was no coloured blob on the backslash key just means you don’t use it very often.

Brandon

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

This also depends on the keyboard layout you have. I mean looking at the English keyboard layout the \ character is presented and easily accessible with just a single tap.

For me it’s always been a problem, this is not a strong argument for changing that behavior but it would ease at least my workflow.

Shift + CMD + 7 == \ for my German keyboard layout.

···

--
Adrian Zubarev
Sent with Airmail

Am 22. Juni 2016 um 18:21:10, Jeremy Pereira via swift-evolution (swift-evolution@swift.org) schrieb:

On 22 Jun 2016, at 17:02, Brandon Knope <bknope@me.com> wrote:

No it shows where your hand frequently is also

And you don’t think there is a correlation between where the frequently pressed keys are and where your hands are? If you were needing to press the \ key a lot, there would be a hotspot over it. Then you could say “look, I need to press this key a lot and it’s miles away from the other hotspot”.

Brandon

On Jun 22, 2016, at 12:01 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 16:41, Brandon Knope <bknope@me.com> wrote:

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Your heat map doesn’t test the usability of a key, it tests the frequency with which it was pressed. The fact that there was no coloured blob on the backslash key just means you don’t use it very often.

Brandon

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

The same that a good sentinel value is one that is invalid. A good escape character is one that is rarely used. If as suggested $() or @() is used, one would have, unless extra look ahead magic is added to the parser, would have to write string like "0.99\$" and "swift-evolution\@swift.org"; that's assuming only \() is changed and not all escaping. Using @ or $ for all escaping is so ugly to me, that I cannot write an sample of what it would look like.

One could of course argue that the look ahead is tiny, but escaping in the rare case that "$(" need to be displayed one would have to use "\$("; so some $ need escaping, whic can be seen as inconsistent and confusing.

So sticking to '\' looks like a good idea.

Dany

···

Le 22 juin 2016 à 12:27, Brandon Knope via swift-evolution <swift-evolution@swift.org> a écrit :

I really don’t understand why we are wasting everyone’s time debating this.

Yes I think there is a correlation. Yes this is precisely why I posted the heat map.

Of course \ is not needed a lot, but when it is, *it is inconvenient for *some* people*. I am not making this up. You can cite several other users from this very thread.

I tried showing that it is quite distant on the keyboard from where the user’s hands rest. I tried showing that there are other keys at their finger tips where their hand is usually resting.

1. Do I know every international keyboard layout? No.
2. Are we pretending that \ was picked because it was easier for international users? If I am wrong, I would love to hear more…else let’s not pretend that \ was the optimal key for all.

Of course \ is not needed a lot but when it is, *it is inconvenient for *some* people*. I am not making this up. You can cite several other users from this very thread.

That’s the point. Convenient key stroke sequences should be used for things you need a lot before things you don’t use a lot.

I tried showing that it is quite distant on the keyboard from where the user’s hands rest. I tried showing that there are other keys at their finger tips where their hand is usually resting.

1. Do I know every international keyboard layout? No.
2. Are we pretending that \ was picked because it was easier for international users? If I am wrong, I would love to hear more…else let’s not pretend that \ was the optimal key for all.

No, it was picked because it is the escape character for strings. The escape character(s) for strings need to be few in number (one is ideal IMO) and characters that you aren’t likely to need to type in a string as literals. $ is a particularly bad choice due to its popularity as a currency symbol.

Like I have said repeatedly…I don’t care if \ is removed. At this point we are wasting other people’s time. I have just tried to be a voice for those that find it awkward and inconvenient.

I would challenge the claim that on a US keyboard or a British keyboard, the \ key is inconvenient to type. In both cases, you don’t even have to press the shift key. If you are a touch typist (I’m not), it’s a slight stretch for the right hand, but no more so than the return key or backspace (I use backspace *a lot*).

However, I do find the \( *combination* a little awkward but this is because of the way I normally type the (, but I would find having to type \$ every time I wanted a dollar sign intensely annoying because it is so unnecessary.

I tried not to base this just on opinion but on some *evidence*, but apparently that isn’t sufficient enough for some.

And I was just trying to point out that the evidence you presented does not show what you think it does. If you present evidence, I’m allowed to dispute it aren’t I?

···

On 22 Jun 2016, at 17:27, Brandon Knope <bknope@me.com> wrote:

Brandon

On Jun 22, 2016, at 12:20 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 17:02, Brandon Knope <bknope@me.com> wrote:

No it shows where your hand frequently is also

And you don’t think there is a correlation between where the frequently pressed keys are and where your hands are? If you were needing to press the \ key a lot, there would be a hotspot over it. Then you could say “look, I need to press this key a lot and it’s miles away from the other hotspot”.

Brandon

On Jun 22, 2016, at 12:01 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 16:41, Brandon Knope <bknope@me.com> wrote:

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Your heat map doesn’t test the usability of a key, it tests the frequency with which it was pressed. The fact that there was no coloured blob on the backslash key just means you don’t use it very often.

Brandon

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

I’m going to register a -1 on this proposal. I appreciate the work that went into it, but I just don’t think any advantages for the developer community as a whole weight enough to warrant the change.

Of course \ is not needed a lot but when it is, *it is inconvenient for *some* people*. I am not making this up. You can cite several other users from this very thread.

That’s the point. Convenient key stroke sequences should be used for things you need a lot before things you don’t use a lot.

I tried showing that it is quite distant on the keyboard from where the user’s hands rest. I tried showing that there are other keys at their finger tips where their hand is usually resting.

1. Do I know every international keyboard layout? No.
2. Are we pretending that \ was picked because it was easier for international users? If I am wrong, I would love to hear more…else let’s not pretend that \ was the optimal key for all.

No, it was picked because it is the escape character for strings. The escape character(s) for strings need to be few in number (one is ideal IMO) and characters that you aren’t likely to need to type in a string as literals. $ is a particularly bad choice due to its popularity as a currency symbol.

Changing this would add more syntax, make layers in usage where one character now exist, and does so without offering a large material advantage, imho.

Like I have said repeatedly…I don’t care if \ is removed. At this point we are wasting other people’s time. I have just tried to be a voice for those that find it awkward and inconvenient.

I would challenge the claim that on a US keyboard or a British keyboard, the \ key is inconvenient to type. In both cases, you don’t even have to press the shift key. If you are a touch typist (I’m not), it’s a slight stretch for the right hand, but no more so than the return key or backspace (I use backspace *a lot*).

Compared to typing Obj-C' , which was when was tired “=“ “delete” or “]” “\”, Swift in general, including \(), is a breeze.

···

On Jun 23, 2016, at 4:41 AM, Jeremy Pereira via swift-evolution <swift-evolution@swift.org> wrote:

On 22 Jun 2016, at 17:27, Brandon Knope <bknope@me.com> wrote:

However, I do find the \( *combination* a little awkward but this is because of the way I normally type the (, but I would find having to type \$ every time I wanted a dollar sign intensely annoying because it is so unnecessary.

I tried not to base this just on opinion but on some *evidence*, but apparently that isn’t sufficient enough for some.

And I was just trying to point out that the evidence you presented does not show what you think it does. If you present evidence, I’m allowed to dispute it aren’t I?

Brandon

On Jun 22, 2016, at 12:20 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 17:02, Brandon Knope <bknope@me.com> wrote:

No it shows where your hand frequently is also

And you don’t think there is a correlation between where the frequently pressed keys are and where your hands are? If you were needing to press the \ key a lot, there would be a hotspot over it. Then you could say “look, I need to press this key a lot and it’s miles away from the other hotspot”.

Brandon

On Jun 22, 2016, at 12:01 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 16:41, Brandon Knope <bknope@me.com> wrote:

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Your heat map doesn’t test the usability of a key, it tests the frequency with which it was pressed. The fact that there was no coloured blob on the backslash key just means you don’t use it very often.

Brandon

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:

I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

I prefer "\" as the consistent escape character in Swift. It's used in many programming languages and (I find it) easy to skim over.

- David

···

On 23 Jun 2016, at 22:21, James Hillhouse via swift-evolution <swift-evolution@swift.org> wrote:

I’m going to register a -1 on this proposal. I appreciate the work that went into it, but I just don’t think any advantages for the developer community as a whole weight enough to warrant the change.

On Jun 23, 2016, at 4:41 AM, Jeremy Pereira via swift-evolution <swift-evolution@swift.org> wrote:

On 22 Jun 2016, at 17:27, Brandon Knope <bknope@me.com> wrote:

Of course \ is not needed a lot but when it is, *it is inconvenient for *some* people*. I am not making this up. You can cite several other users from this very thread.

That’s the point. Convenient key stroke sequences should be used for things you need a lot before things you don’t use a lot.

I tried showing that it is quite distant on the keyboard from where the user’s hands rest. I tried showing that there are other keys at their finger tips where their hand is usually resting.

1. Do I know every international keyboard layout? No.
2. Are we pretending that \ was picked because it was easier for international users? If I am wrong, I would love to hear more…else let’s not pretend that \ was the optimal key for all.

No, it was picked because it is the escape character for strings. The escape character(s) for strings need to be few in number (one is ideal IMO) and characters that you aren’t likely to need to type in a string as literals. $ is a particularly bad choice due to its popularity as a currency symbol.

Changing this would add more syntax, make layers in usage where one character now exist, and does so without offering a large material advantage, imho.

Like I have said repeatedly…I don’t care if \ is removed. At this point we are wasting other people’s time. I have just tried to be a voice for those that find it awkward and inconvenient.

I would challenge the claim that on a US keyboard or a British keyboard, the \ key is inconvenient to type. In both cases, you don’t even have to press the shift key. If you are a touch typist (I’m not), it’s a slight stretch for the right hand, but no more so than the return key or backspace (I use backspace *a lot*).

Compared to typing Obj-C' , which was when was tired “=“ “delete” or “]” “\”, Swift in general, including \(), is a breeze.

However, I do find the \( *combination* a little awkward but this is because of the way I normally type the (, but I would find having to type \$ every time I wanted a dollar sign intensely annoying because it is so unnecessary.

I tried not to base this just on opinion but on some *evidence*, but apparently that isn’t sufficient enough for some.

And I was just trying to point out that the evidence you presented does not show what you think it does. If you present evidence, I’m allowed to dispute it aren’t I?

Brandon

On Jun 22, 2016, at 12:20 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 17:02, Brandon Knope <bknope@me.com> wrote:

No it shows where your hand frequently is also

And you don’t think there is a correlation between where the frequently pressed keys are and where your hands are? If you were needing to press the \ key a lot, there would be a hotspot over it. Then you could say “look, I need to press this key a lot and it’s miles away from the other hotspot”.

Brandon

On Jun 22, 2016, at 12:01 PM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

On 22 Jun 2016, at 16:41, Brandon Knope <bknope@me.com> wrote:

My point was not to argue for the removal of \. My point was that there is a measurable way to test the usability of such a key

Your heat map doesn’t test the usability of a key, it tests the frequency with which it was pressed. The fact that there was no coloured blob on the backslash key just means you don’t use it very often.

Brandon

On Jun 22, 2016, at 11:30 AM, Jeremy Pereira <jeremy.j.pereira@googlemail.com> wrote:

I find it somewhat disturbing that we are now trying to base language design around the layout of a US English keyboard.

“\” on my keyboard (British Macbook Pro Retina) is right next to the return key. It’s also much closer to the parentheses characters than $ is and (if you assume we are going to replace parentheses with braces as was suggested upthread) right next to the brace keys.

Anyway, your heat map evidence actually negates the argument. If it was a frequently used key, it would have a hot spot of its own. It’s not (I tried it on some random samples of my own code), so that implies it is not a key that is used very often, which further implies it *should* be a little out of the way.

*The* escape character for strings is “\”. Please let’s not introduce a second one.

On 22 Jun 2016, at 00:08, Brandon Knope via swift-evolution <swift-evolution@swift.org> wrote:

Actually… we can go pretty scientific on this sort of thing and heat map keyboard usage to get a better picture of how “usable” this is.

I pasted a file that contains seven \’s in it and heat mapped it at Keyboard Heatmap | Realtime heatmap visualization of text character distribution

Even *with* several \’s throughout my source file the majority of my key presses take place much closer to the $ key than the \ key.

I think we can all argue about what is clearer or not, but I think for the majority of us, the \ key is quite inconvenient compared to the keys around where we type the most.

I also ran several of iOS 10’s sample code through the heat map and continue to get pretty similar results: the \ is much further from the hottest part of the keyboard than the ones closer to where your hand usually rests.

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.

Brandon

On Jun 21, 2016, at 6:10 PM, Daniel Resnick via swift-evolution <swift-evolution@swift.org> wrote:

I also disagree for the same reasons that Gwynne and Brent mentioned: I find '\(...)' easy to read, fine to type, and consistent with other string escaping syntax.

On Tue, Jun 21, 2016 at 3:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution@swift.org> wrote:
I find that typing \(var) is very disruptive to my typing flow. The more I code in Swift, the more I like it, but every time I'm coding and then have to hiccup while typing \ then ( causes me to be annoyed. I know, it's minor, but it isn't a key combination that flows quickly.

I would much rather have $() or perhaps ${} (like Groovy lang) or perhaps @() to go along with other uses of @ throughout the language.

Even though I'm used to Perl's and Ruby's interpolation syntaxes, I immediately liked `\(…)`. It's parsimonious: Rather than taking a third character (besides \ and ") to mean something special in a string literal, it reuses one of the existing ones. There's no need to escape a character you wouldn't otherwise have to touch, or to think of another character as "magical" in a string. It fits nicely with the rest of the syntax, with `\` indicating a special construct and then `()` delimiting an expression, just as they do elsewhere in the language. It's an elegant solution to a problem traditionally solved inelegantly. It's very Swifty in that way.

A shifted key, like $ or @, followed by another shifted key like (, allows for a much faster flow and they are much closer to the home keys than \ which is nearly as far from home keys as possible (and awkward).

I don't have any trouble typing it personally. If you find yourself accidentally typing `\9` or `|(`, we could probably offer an error for the former or warning for the latter with a fix-it. But if you're complaining that it takes a tiny fraction of a second longer to type than `$(` would, then honestly, I just can't bring myself to care. Swift optimizes for code reading. If we wanted to optimize for code typing instead, we'd have a very different style.

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution