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

2016-06-26 Thread David Rönnqvist via 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 
>  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 
>>  wrote:
>> 
>> 
>>> On 22 Jun 2016, at 17:27, Brandon Knope  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 
  wrote:
 
 
> On 22 Jun 2016, at 17:02, Brandon Knope  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 
>>  wrote:
>> 
>> 
>>> On 22 Jun 2016, at 16:41, Brandon Knope  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 
  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 

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

2016-06-23 Thread James Hillhouse via 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.

> On Jun 23, 2016, at 4:41 AM, Jeremy Pereira via swift-evolution 
>  wrote:
> 
> 
>> On 22 Jun 2016, at 17:27, Brandon Knope  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 
>>>  wrote:
>>> 
>>> 
 On 22 Jun 2016, at 17:02, Brandon Knope  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 
>  wrote:
> 
> 
>> On 22 Jun 2016, at 16:41, Brandon Knope  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 
>>>  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 

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

2016-06-23 Thread Jeremy Pereira via swift-evolution

> On 22 Jun 2016, at 17:27, Brandon Knope  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.

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

> 
> Brandon
> 
> 
>> On Jun 22, 2016, at 12:20 PM, Jeremy Pereira 
>>  wrote:
>> 
>> 
>>> On 22 Jun 2016, at 17:02, Brandon Knope  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 
  wrote:
 
 
> On 22 Jun 2016, at 16:41, Brandon Knope  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 
>>  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 
>>>  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.
>>> 

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

2016-06-22 Thread Dany St-Amant via swift-evolution

> Le 22 juin 2016 à 12:27, Brandon Knope via swift-evolution 
>  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.

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


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

2016-06-22 Thread David Waite via swift-evolution

> On Jun 22, 2016, at 4:19 AM, Haravikk via swift-evolution 
>  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.

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


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

2016-06-22 Thread Brandon Knope via swift-evolution
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 
>  wrote:
> 
> 
>> On 22 Jun 2016, at 17:02, Brandon Knope  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 
>>>  wrote:
>>> 
>>> 
 On 22 Jun 2016, at 16:41, Brandon Knope  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 
>  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 
>>  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 
>>>  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 
>>>  wrote:
 I find that typing \(var) is very disruptive to my typing flow. 

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

2016-06-22 Thread Jeremy Pereira via swift-evolution

> On 22 Jun 2016, at 16:41, Brandon Knope  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 
>>  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 
>>>  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 
  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 
  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
 
 ___
 

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

2016-06-22 Thread Jeremy Pereira via swift-evolution

> On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution 
>  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 “\").
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-22 Thread Brandon Knope via 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

Brandon

> On Jun 22, 2016, at 11:30 AM, Jeremy Pereira 
>  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 
>>  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 
>>>  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 
>>>  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
>> 

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

2016-06-22 Thread Wahlstedt Jyrki via swift-evolution

> On 22.6.2016, at 1.10, Daniel Resnick via swift-evolution 
>  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.

+1

I’m using Finnish keyboard, for \ the key combination is opt-shift-7, then () 
are shift-8 and shift-9, so very easy. Actually, using @ (opt-2) or $ (opt-4) 
would be harder, because one would have to switch hands, using opt with right 
hand and then using left hand for shift for () or opt-shift for {}.
The code is written once, but read maybe thousands of times, so readability is 
immensely more important.

!
! Jyrki Wahlstedt
!   http://www.wahlstedt.fi/jyrki/ Twitter: @jyrkiw
!
! Our life is no dream; but it ought to become one and perhaps will.
! 



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


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

2016-06-22 Thread Jeremy Pereira via swift-evolution
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 
>  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 
>>  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 
>>  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


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

2016-06-22 Thread João Pinheiro via swift-evolution
On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution 
 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.

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


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

2016-06-22 Thread Leonardo Pessoa via swift-evolution
I'll stick with Gwynne here. Each language has its syntax for
interpolating string and as such I don't see a reason to change this.
As for formatting, I agree it is an issue but we have to remember that
inside \() we have code that can do pretty much everything one may
need. You may even add a formatting function to String or Int in order
to produce the result you need (even simplifying the calls to
NumberFormatter - I myself have a whole library of "shortcuts" I add
to every project).

L

On 21 June 2016 at 18:49, Gwynne Raskind via swift-evolution
 wrote:
> On Jun 21, 2016, at 15:48, Jonathan Cotton via swift-evolution
>  wrote:
>
> I'd support $() as is in use by other languages, including Kotlin, as
> mentioned it seems less disruptive and more inline with the tokenised
> parameters that are already supported in closures.
>
> On 21 Jun 2016, at 21:43, Kenny Wyland via swift-evolution
>  wrote:
>
> Hi all,
>
> I'm new to the list and I just searched through the archives as best I could
> to see if someone else had already brought this up, but I didn't find
> anything. Forgive me if this horse has been beaten.
>
> 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.
>
> 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).
>
> Thoughts?
>
> Kenny Wyland
> InADayDevelopment.com
>
>
> I have to disagree - The \ syntax is consistent with other string escape
> sequences (\n etc.) and reads naturally to me in that regard. Additionally,
> the \ is very visually distinctive in a string, much moreso than the
> "traditional" $ variable marker. Almost every language I’ve seen using $ for
> interpolation in strings is doing so because it also uses it as a variable
> prefix in non-string contexts. To top it off, using $ instead would, for me,
> just add yet another language for which I have to remember "does the $ go
> inside or outside the name delimiter braces/brackets/whatever?", "is it
> parenthesis, braces, brackets, or some other delimiter for variable names?",
> "what kind of expressions can I use in this context?", "can I use
> interpolation without any delimiters for simple cases?", etc. See also PHP,
> Perl, ten flavors of shell scripts, JavaScript, JSP/ASP, XPath, and so
> forth. The \() syntax is unique to Swift and therefore very easy to
> remember.
>
> I also don’t see that Swift carries an expectation of being able to use a
> syntax which is traditionally confined to interpreted/scripting languages,
> and even there $ is by no means ubiquitous. Here are just a few
> counterexamples among various languages:
>
> - C (printf formats)
> - C++ (stream modifiers)
> - Objective-C (NSString formats)
> - C# ($, but with the unusual syntax $"blah {foo} blah")
> - Lua (printf formats and language hacks)
> - Python (printf formats with trailing "% (tuple)" syntax)
> - Ruby ("#{}")
> - Java (printf formats)
>
> There’s an obvious pattern in these example, which brings to something I
> _would_ like to see for string interpolation in Swift: Better control over
> the precise representation of the data. I’m sure the topic has been done to
> death many times before, but I haven’t found any solid information at a
> quick search, so I apologize if this is all old hat.
>
> Anyway - Creating, configuring, and invoking various Formatter types in
> order to present data in the proper fashion is an option, and a preferable
> one when the data is intended for user consumption (especially to get the
> maximum support from localization). But for logging, debugging, parsing of
> textual formats, writing textual formats, etc., I almost always want a
> traditional C/POSIX/ISO representation as easily provided by printf()-style
> specifiers. 99% of the time when I want to do an number-to-string (integer
> or otherwise) conversion especially, I’m being specific about the appearance
> of the number.
>
> For example, for a hex representation of sockaddr_in.sin_addr.s_addr, I
> would in other languages write "printf("0x%08x", address.sin_addr.s_addr);",
> or "%02hhu" times four to get dotted-decimal notation. (Ignoring for the
> moment the existence of inet_ntop() for the sake of the example :). In
> Swift, I currently have to make a call to printf(), fprintf(), dprintf(),
> NSString(format:), asprintf() (with a wrapper to deal with getting a
> Swift.String from allocated memory), etc. A configured NumberFormatter
> instance is a 

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

2016-06-22 Thread Goffredo Marocchi via swift-evolution
> 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  wrote:
> 
> 
>> On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution 
>>  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.
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-22 Thread Haravikk via swift-evolution

> On 22 Jun 2016, at 09:39, Goffredo Marocchi via swift-evolution 
>  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.___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-22 Thread Goffredo Marocchi via 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 
 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 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
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-22 Thread Charlie Monroe via swift-evolution
> 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 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


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

2016-06-22 Thread Goffredo Marocchi via swift-evolution
An argument could be made that the '\' character is used to escape and when you 
are doing string interpolation/printing you are clearly doing an operation more 
similar to bash's use of '$' to extract the value of a variable than escaping.

The need to logically separate escaping from parameter value extraction/string 
interpolation is IMHO grounds for this change alone.

Sent from my iPhone

> On 21 Jun 2016, at 23:35, Haravikk via swift-evolution 
>  wrote:
> 
> 
>>> On 21 Jun 2016, at 22:49, Gwynne Raskind via swift-evolution 
>>>  wrote:
>>> 
>>> On Jun 21, 2016, at 15:48, Jonathan Cotton via swift-evolution 
>>>  wrote:
>>> 
>>> I'd support $() as is in use by other languages, including Kotlin, as 
>>> mentioned it seems less disruptive and more inline with the tokenised 
>>> parameters that are already supported in closures.
>>> 
 On 21 Jun 2016, at 21:43, Kenny Wyland via swift-evolution 
  wrote:
 
 Hi all,
 
 I'm new to the list and I just searched through the archives as best I 
 could to see if someone else had already brought this up, but I didn't 
 find anything. Forgive me if this horse has been beaten.
 
 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. 
 
 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). 
 
 Thoughts?
 
 Kenny Wyland
 InADayDevelopment.com
>> 
>> I have to disagree - The \ syntax is consistent with other string escape 
>> sequences (\n etc.) and reads naturally to me in that regard. Additionally, 
>> the \ is very visually distinctive in a string, much moreso than the 
>> "traditional" $ variable marker. Almost every language I’ve seen using $ for 
>> interpolation in strings is doing so because it also uses it as a variable 
>> prefix in non-string contexts. To top it off, using $ instead would, for me, 
>> just add yet another language for which I have to remember "does the $ go 
>> inside or outside the name delimiter braces/brackets/whatever?", "is it 
>> parenthesis, braces, brackets, or some other delimiter for variable names?", 
>> "what kind of expressions can I use in this context?", "can I use 
>> interpolation without any delimiters for simple cases?", etc. See also PHP, 
>> Perl, ten flavors of shell scripts, JavaScript, JSP/ASP, XPath, and so 
>> forth. The \() syntax is unique to Swift and therefore very easy to remember.
> 
> I agree with this; Swift’s only other dollar sign use is for closure 
> shorthand variables, which is technically a non-string context but I assume 
> you mean on *all* variables. Anyway, I think \() is actually a good way to do 
> this, as it’s unambiguous, and not something you’re likely to type by 
> mistake, since you don’t need to escape the brackets for any other purpose. 
> The way I think of it is as an escape from the string, which is IMO more 
> logical than a variable inside a string which dollar notation brings to mind 
> (for me at least).
> ___
> 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


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

2016-06-22 Thread Michael Peternell via swift-evolution

> Am 22.06.2016 um 02:11 schrieb Dave Abrahams via swift-evolution 
> :
> 
> 
> on Tue Jun 21 2016, Brandon Knope  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 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.

-Michael

> 
> -- 
> Dave

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


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

2016-06-22 Thread Haravikk via swift-evolution

> On 21 Jun 2016, at 22:49, Gwynne Raskind via swift-evolution 
>  wrote:
> 
>> On Jun 21, 2016, at 15:48, Jonathan Cotton via swift-evolution 
>> > wrote:
>> 
>> I'd support $() as is in use by other languages, including Kotlin, as 
>> mentioned it seems less disruptive and more inline with the tokenised 
>> parameters that are already supported in closures.
>> 
>>> On 21 Jun 2016, at 21:43, Kenny Wyland via swift-evolution 
>>> > wrote:
>>> 
>>> Hi all,
>>> 
>>> I'm new to the list and I just searched through the archives as best I 
>>> could to see if someone else had already brought this up, but I didn't find 
>>> anything. Forgive me if this horse has been beaten.
>>> 
>>> 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. 
>>> 
>>> 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). 
>>> 
>>> Thoughts?
>>> 
>>> Kenny Wyland
>>> InADayDevelopment.com 
> 
> I have to disagree - The \ syntax is consistent with other string escape 
> sequences (\n etc.) and reads naturally to me in that regard. Additionally, 
> the \ is very visually distinctive in a string, much moreso than the 
> "traditional" $ variable marker. Almost every language I’ve seen using $ for 
> interpolation in strings is doing so because it also uses it as a variable 
> prefix in non-string contexts. To top it off, using $ instead would, for me, 
> just add yet another language for which I have to remember "does the $ go 
> inside or outside the name delimiter braces/brackets/whatever?", "is it 
> parenthesis, braces, brackets, or some other delimiter for variable names?", 
> "what kind of expressions can I use in this context?", "can I use 
> interpolation without any delimiters for simple cases?", etc. See also PHP, 
> Perl, ten flavors of shell scripts, JavaScript, JSP/ASP, XPath, and so forth. 
> The \() syntax is unique to Swift and therefore very easy to remember.

I agree with this; Swift’s only other dollar sign use is for closure shorthand 
variables, which is technically a non-string context but I assume you mean on 
*all* variables. Anyway, I think \() is actually a good way to do this, as it’s 
unambiguous, and not something you’re likely to type by mistake, since you 
don’t need to escape the brackets for any other purpose. The way I think of it 
is as an escape from the string, which is IMO more logical than a variable 
inside a string which dollar notation brings to mind (for me at least).___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-21 Thread Wahlstedt Jyrki via swift-evolution

> On 22.6.2016, at 1.10, Daniel Resnick via swift-evolution 
> > 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.

+1

I’m using Finnish keyboard, for \ the key combination is opt-shift-7, then () 
are shift-8 and shift-9, so very easy. Actually, using @ (opt-2) or $ (opt-4) 
would be harder, because one would have to switch hands, using opt with right 
hand and then using left hand for shift for () or opt-shift for {}.
The code is written once, but read maybe thousands of times, so readability is 
immensely more important.

!
! Jyrki Wahlstedt
!   http://www.wahlstedt.fi/jyrki/  
Twitter: @jyrkiw
!
! Our life is no dream; but it ought to become one and perhaps will.
! 



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


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

2016-06-21 Thread Chris Lattner via swift-evolution

> On Jun 21, 2016, at 3:51 PM, Jordan Rose via swift-evolution 
>  wrote:
> 
> 
>> On Jun 21, 2016, at 15:26, Xiaodi Wu via swift-evolution 
>> > wrote:
>> 
>> On Tue, Jun 21, 2016 at 5:10 PM, Daniel Resnick via swift-evolution 
>> > 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.
>> 
>> Those are persuasive arguments. Consistency with other string escaping 
>> syntax is a huge plus. Moreover, now that I think about it, \r or \n isn't 
>> really a bother to type. The \( combination takes a little getting used to, 
>> but it's not absurdly terrible. I suppose we could consider \{} or even \[] 
>> instead of \() to alleviate the reach.
> 
> Gwynne and Brent indeed hit on the logic for the original design: backslash 
> is already an escape character in strings. The parentheses () over another 
> kind of delimiter were originally to match calls (string interpolation once 
> generated direct calls to String initializers), but even without that it’s 
> still something that’s used with expressions, while curly braces {} are used 
> for general code blocks and square brackets [] are used with collections.
> 
> I’m strongly in favor of keeping things the way they are, both because I like 
> it a fair bit and because it’d be another source-breaking change that would 
> be very hard to migrate.

I completely agree with Jordan.

This is a classical bikeshed, and any new design would have to be extremely 
compelling, because it would have to overcome the advantage of the \() 
approach: that it is compatible with the use of \ as the escape character for 
other things.  It would be really unfortunate to have to start escaping $ or 
whatever other character you would pick.

-Chris

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


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

2016-06-21 Thread Matthew Johnson via swift-evolution


Sent from my iPad

> On Jun 21, 2016, at 5:51 PM, Jordan Rose via swift-evolution 
>  wrote:
> 
> 
>> On Jun 21, 2016, at 15:26, Xiaodi Wu via swift-evolution 
>>  wrote:
>> 
>>> On Tue, Jun 21, 2016 at 5:10 PM, Daniel Resnick via swift-evolution 
>>>  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.
>> 
>> Those are persuasive arguments. Consistency with other string escaping 
>> syntax is a huge plus. Moreover, now that I think about it, \r or \n isn't 
>> really a bother to type. The \( combination takes a little getting used to, 
>> but it's not absurdly terrible. I suppose we could consider \{} or even \[] 
>> instead of \() to alleviate the reach.
> 
> Gwynne and Brent indeed hit on the logic for the original design: backslash 
> is already an escape character in strings. The parentheses () over another 
> kind of delimiter were originally to match calls (string interpolation once 
> generated direct calls to String initializers), but even without that it’s 
> still something that’s used with expressions, while curly braces {} are used 
> for general code blocks and square brackets [] are used with collections.
> 
> I’m strongly in favor of keeping things the way they are, both because I like 
> it a fair bit and because it’d be another source-breaking change that would 
> be very hard to migrate.

+1.  I really liked this when I Swift was first released.  Using the existing 
escape character makes perfect sense.  We've made enough breaking changes for 
what are arguably aesthetic preferences.  The bar should be higher going 
forward and I really don't think this makes the cut.

> 
> Jordan
> 
> ___
> 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


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

2016-06-21 Thread David Sweeris via swift-evolution

> On Jun 21, 2016, at 17:26, Xiaodi Wu via swift-evolution 
>  wrote:
> 

> The \( combination takes a little getting used to, but it's not absurdly 
> terrible. I suppose we could consider \{} or even \[] instead of \() to 
> alleviate the reach.

\{} is kinda nice because it mirrors the closure syntax.

- Dave Sweeris
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-21 Thread Xiaodi Wu via swift-evolution
On Tue, Jun 21, 2016 at 7:10 PM, Kenny Wyland  wrote:

> On Tue, Jun 21, 2016 at 5:07 PM, Xiaodi Wu  wrote:
>
>> (Whoops, reply to list; also adding a reply.)
>>
>> On Tue, Jun 21, 2016 at 6:55 PM, Kenny Wyland  wrote:
>>
>>> On Tue, Jun 21, 2016 at 4:40 PM, Xiaodi Wu via swift-evolution <
>>> swift-evolution@swift.org> wrote:
>>>
 On Tue, Jun 21, 2016 at 6:25 PM, Brandon Knope  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.
>

 As I pointed out, your results are flawed because there are two keys
 frequently reached for in the vicinity of \ which are excluded from your
 analysis. Those keys are delete/backspace and return/enter.

>>>
>>> True, however, both of those keys (delete/backspace and return/enter)
>>> are over-sized for the specific reasons that they are difficult to hit in
>>> that position and we use them a lot so we compensate by making them larger.
>>>
>>
>> If you google some pictures of typewriter keyboards, you'll see that the
>> backspace key was once the same size as all other keys (whereas the shift
>> keys and space bar were not). Moreover, if you check out international
>> keyboards, you'll find that several of these keys vary in size based on
>> country, so clearly their specific size is not considered to be very
>> important (even though (I presume) people delete things and advance lines
>> at similar frequencies regardless of language). So I don't really buy the
>> idea that these keys are sized "for the specific reason that they are
>> difficult to hit."
>>
>
> International support and ease of use is certainly important, but I'm not
> sure how old typewriter keyboards are any sort of valid data point in the
> discussion.
>

Well, given that hand sizes haven't really changed, it's an entirely valid
data point with respect to your assertion that certain parts of the
keyboard are difficult to hit. In fact, I'd argue it's probably one of the
better data points. Our keyboard layouts today are constrained in part by
habit and tradition, and what's more, we're more numb now to how learnable
typing really is because the skill is now so commonplace. But given a blank
slate, and with ample concern about the learning curve, our forbears could
make the keys almost any size they wished--and they chose a small backspace
key.


>
> Kenny
>
>
>
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-21 Thread Dave Abrahams via swift-evolution

on Tue Jun 21 2016, Brandon Knope  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.

-- 
Dave

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


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

2016-06-21 Thread Brandon Knope via swift-evolution


Sent from my iPad

> On Jun 21, 2016, at 8:07 PM, Xiaodi Wu via swift-evolution 
>  wrote:
> 
> (Whoops, reply to list; also adding a reply.)
> 
> On Tue, Jun 21, 2016 at 6:55 PM, Kenny Wyland  wrote:
>>> On Tue, Jun 21, 2016 at 4:40 PM, Xiaodi Wu via swift-evolution 
>>>  wrote:
 On Tue, Jun 21, 2016 at 6:25 PM, Brandon Knope  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.
>>> 
>>> As I pointed out, your results are flawed because there are two keys 
>>> frequently reached for in the vicinity of \ which are excluded from your 
>>> analysis. Those keys are delete/backspace and return/enter.
>> 
>> True, however, both of those keys (delete/backspace and return/enter) are 
>> over-sized for the specific reasons that they are difficult to hit in that 
>> position and we use them a lot so we compensate by making them larger. 
> 
> If you google some pictures of typewriter keyboards, you'll see that the 
> backspace key was once the same size as all other keys (whereas the shift 
> keys and space bar were not). Moreover, if you check out international 
> keyboards, you'll find that several of these keys vary in size based on 
> country, so clearly their specific size is not considered to be very important

Are you surprised that usability isn't taken into consideration for a lot of 
products?

Brandon

> (even though (I presume) people delete things and advance lines at similar 
> frequencies regardless of language). So I don't really buy the idea that 
> these keys are sized "for the specific reason that they are difficult to hit."
>  
 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...
 
>>> 
>>> We've discussed why it's sensible grammar; there is no argument to be made 
>>> here about whether pressing one labeled key or another is friendlier to a 
>>> beginner.
>> 
>> The idea that \ is already a special character inside strings isn't a valid 
>> argument for it being the -best- choice, it's simply an argument for it 
>> being the -easiest to code for- in the compiler. Backslashes in strings are 
>> used for special characters like \n, but I don't know of any language, other 
>> than Swift, that uses them for variable interpolation.
>> 
>> So, if we're also talking about being friendlier to a beginner, I think that 
>> using blackslash is a disservice to them because it teaches them a pattern 
>> that isn't used by any other language for intra-string variable 
>> interpolation.
> 
> Gwynne's argument here was persuasive to me, which is that each major 
> C-family language takes a different approach to interpolation. There is no 
> symbol which can be said to be widely used. Which is not to say that there 
> aren't poor choices and better ones.
>  
>> 
>> Kenny Wyland
>>  
>>>  
 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.
>>> 
>>> See above; you measured wrong...
>>>  
 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  wrote:
> 
>> On Tue, Jun 21, 2016 at 6:08 PM, Brandon Knope via swift-evolution 
>>  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 

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

2016-06-21 Thread Xiaodi Wu via swift-evolution
(Whoops, reply to list; also adding a reply.)

On Tue, Jun 21, 2016 at 6:55 PM, Kenny Wyland  wrote:

> On Tue, Jun 21, 2016 at 4:40 PM, Xiaodi Wu via swift-evolution <
> swift-evolution@swift.org> wrote:
>
>> On Tue, Jun 21, 2016 at 6:25 PM, Brandon Knope  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.
>>>
>>
>> As I pointed out, your results are flawed because there are two keys
>> frequently reached for in the vicinity of \ which are excluded from your
>> analysis. Those keys are delete/backspace and return/enter.
>>
>
> True, however, both of those keys (delete/backspace and return/enter) are
> over-sized for the specific reasons that they are difficult to hit in that
> position and we use them a lot so we compensate by making them larger.
>

If you google some pictures of typewriter keyboards, you'll see that the
backspace key was once the same size as all other keys (whereas the shift
keys and space bar were not). Moreover, if you check out international
keyboards, you'll find that several of these keys vary in size based on
country, so clearly their specific size is not considered to be very
important (even though (I presume) people delete things and advance lines
at similar frequencies regardless of language). So I don't really buy the
idea that these keys are sized "for the specific reason that they are
difficult to hit."


> 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...
>>>
>>>
>> We've discussed why it's sensible grammar; there is no argument to be
>> made here about whether pressing one labeled key or another is friendlier
>> to a beginner.
>>
>
> The idea that \ is already a special character inside strings isn't a
> valid argument for it being the -best- choice, it's simply an argument for
> it being the -easiest to code for- in the compiler. Backslashes in strings
> are used for special characters like \n, but I don't know of any language,
> other than Swift, that uses them for variable interpolation.
>
> So, if we're also talking about being friendlier to a beginner, I think
> that using blackslash is a disservice to them because it teaches them a
> pattern that isn't used by any other language for intra-string variable
> interpolation.
>

Gwynne's argument here was persuasive to me, which is that each major
C-family language takes a different approach to interpolation. There is no
symbol which can be said to be widely used. Which is not to say that there
aren't poor choices and better ones.


>
> Kenny Wyland
>
>
>>
>>
>>> 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.
>>>
>>
>> See above; you measured wrong...
>>
>>
>>> 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  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
 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.

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

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

2016-06-21 Thread Sean Heber via 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 
>  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  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 
>>>  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  wrote:
 
> On Tue, Jun 21, 2016 at 6:08 PM, Brandon Knope via swift-evolution 
>  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.
 
 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 
>>  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 
>>>  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 

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

2016-06-21 Thread Brandon Knope via 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  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 
>>  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  wrote:
>>> 
 On Tue, Jun 21, 2016 at 6:08 PM, Brandon Knope via swift-evolution 
  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.
>>> 
>>> 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 
>  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 
>>  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 

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

2016-06-21 Thread Andrey Fidrya via swift-evolution
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 
>  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 > > wrote:
>> 
>> On Tue, Jun 21, 2016 at 6:08 PM, Brandon Knope via swift-evolution 
>> > 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.
>> 
>> 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 
>>> > 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 
>>> > 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 

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

2016-06-21 Thread Brandon Knope via swift-evolution
Unfortunately I know nothing about international keyboards.

But surely someone could heat map their international keyboards?

I don't want to take this to ridiculous levels, but I hope I am making somewhat 
of a point here. Maybe not =/

Brandon

Sent from my iPad

On Jun 21, 2016, at 7:38 PM, Erica Sadun  wrote:

>>> You know what *is* unusable though? Try finding the $ key on an 
>>> international keyboard.
> 
> And that, for me, is motivation in a nutshell. Swift won't always be used on 
> OS X, where it's easy to set up Keyboard prefs to substitute (dollar) with $. 
> 
> I did a search for "which symbol keys appear on most international keyboards" 
> but didn't get very far. Surely this is something to bring into the 
> discussion if it exists?
> 
> -- E
> 
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-21 Thread Xiaodi Wu via swift-evolution
On Tue, Jun 21, 2016 at 6:25 PM, Brandon Knope  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.
>

As I pointed out, your results are flawed because there are two keys
frequently reached for in the vicinity of \ which are excluded from your
analysis. Those keys are delete/backspace and return/enter.


>
> 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...
>
>
We've discussed why it's sensible grammar; there is no argument to be made
here about whether pressing one labeled key or another is friendlier to a
beginner.


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

See above; you measured wrong...


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

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

2016-06-21 Thread Erica Sadun via swift-evolution
>> You know what *is* unusable though? Try finding the $ key on an 
>> international keyboard.

And that, for me, is motivation in a nutshell. Swift won't always be used on OS 
X, where it's easy to set up Keyboard prefs to substitute (dollar) with $. 

I did a search for "which symbol keys appear on most international keyboards" 
but didn't get very far. Surely this is something to bring into the discussion 
if it exists?

-- E

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


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

2016-06-21 Thread Brandon Knope via swift-evolution
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  wrote:
> 
> On Tue, Jun 21, 2016 at 6:08 PM, Brandon Knope via swift-evolution 
> > 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.
> 
> 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 
>> > 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 
>> > 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.

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

2016-06-21 Thread Xiaodi Wu via swift-evolution
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
> 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.
>

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


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

2016-06-21 Thread David Hart via swift-evolution
I’m not saying its necessarily *easy* to type, but I think its good enough to 
warrant the elegance of having only one escaping character instead of multiple.

> On 22 Jun 2016, at 01:08, Brandon Knope via swift-evolution 
>  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 
>> > 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 
>> > 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


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

2016-06-21 Thread Brandon Knope via swift-evolution
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 
>  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 
> > 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


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

2016-06-21 Thread David Hart via swift-evolution
Entirely agree. \ makes total sense as the one-and-only escaping character. I 
also have no trouble typing it.

> On 21 Jun 2016, at 23:55, Brent Royal-Gordon via swift-evolution 
>  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


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

2016-06-21 Thread Jordan Rose via swift-evolution

> On Jun 21, 2016, at 15:26, Xiaodi Wu via swift-evolution 
>  wrote:
> 
> On Tue, Jun 21, 2016 at 5:10 PM, Daniel Resnick via swift-evolution 
> > 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.
> 
> Those are persuasive arguments. Consistency with other string escaping syntax 
> is a huge plus. Moreover, now that I think about it, \r or \n isn't really a 
> bother to type. The \( combination takes a little getting used to, but it's 
> not absurdly terrible. I suppose we could consider \{} or even \[] instead of 
> \() to alleviate the reach.

Gwynne and Brent indeed hit on the logic for the original design: backslash is 
already an escape character in strings. The parentheses () over another kind of 
delimiter were originally to match calls (string interpolation once generated 
direct calls to String initializers), but even without that it’s still 
something that’s used with expressions, while curly braces {} are used for 
general code blocks and square brackets [] are used with collections.

I’m strongly in favor of keeping things the way they are, both because I like 
it a fair bit and because it’d be another source-breaking change that would be 
very hard to migrate.

Jordan

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


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

2016-06-21 Thread Xiaodi Wu via swift-evolution
On Tue, Jun 21, 2016 at 5: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.
>

Those are persuasive arguments. Consistency with other string escaping
syntax is a huge plus. Moreover, now that I think about it, \r or \n isn't
really a bother to type. The \( combination takes a little getting used to,
but it's not absurdly terrible. I suppose we could consider \{} or even \[]
instead of \() to alleviate the reach.



> 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


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

2016-06-21 Thread Daniel Resnick via swift-evolution
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


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

2016-06-21 Thread Brent Royal-Gordon via swift-evolution
> 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


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

2016-06-21 Thread Gwynne Raskind via swift-evolution
> On Jun 21, 2016, at 15:48, Jonathan Cotton via swift-evolution 
>  wrote:
> 
> I'd support $() as is in use by other languages, including Kotlin, as 
> mentioned it seems less disruptive and more inline with the tokenised 
> parameters that are already supported in closures.
> 
>> On 21 Jun 2016, at 21:43, Kenny Wyland via swift-evolution 
>>  wrote:
>> 
>> Hi all,
>> 
>> I'm new to the list and I just searched through the archives as best I could 
>> to see if someone else had already brought this up, but I didn't find 
>> anything. Forgive me if this horse has been beaten.
>> 
>> 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. 
>> 
>> 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). 
>> 
>> Thoughts?
>> 
>> Kenny Wyland
>> InADayDevelopment.com 

I have to disagree - The \ syntax is consistent with other string escape 
sequences (\n etc.) and reads naturally to me in that regard. Additionally, the 
\ is very visually distinctive in a string, much moreso than the "traditional" 
$ variable marker. Almost every language I’ve seen using $ for interpolation in 
strings is doing so because it also uses it as a variable prefix in non-string 
contexts. To top it off, using $ instead would, for me, just add yet another 
language for which I have to remember "does the $ go inside or outside the name 
delimiter braces/brackets/whatever?", "is it parenthesis, braces, brackets, or 
some other delimiter for variable names?", "what kind of expressions can I use 
in this context?", "can I use interpolation without any delimiters for simple 
cases?", etc. See also PHP, Perl, ten flavors of shell scripts, JavaScript, 
JSP/ASP, XPath, and so forth. The \() syntax is unique to Swift and therefore 
very easy to remember.

I also don’t see that Swift carries an expectation of being able to use a 
syntax which is traditionally confined to interpreted/scripting languages, and 
even there $ is by no means ubiquitous. Here are just a few counterexamples 
among various languages:

- C (printf formats)
- C++ (stream modifiers)
- Objective-C (NSString formats)
- C# ($, but with the unusual syntax $"blah {foo} blah")
- Lua (printf formats and language hacks)
- Python (printf formats with trailing "% (tuple)" syntax)
- Ruby ("#{}")
- Java (printf formats)

There’s an obvious pattern in these example, which brings to something I 
_would_ like to see for string interpolation in Swift: Better control over the 
precise representation of the data. I’m sure the topic has been done to death 
many times before, but I haven’t found any solid information at a quick search, 
so I apologize if this is all old hat.

Anyway - Creating, configuring, and invoking various Formatter types in order 
to present data in the proper fashion is an option, and a preferable one when 
the data is intended for user consumption (especially to get the maximum 
support from localization). But for logging, debugging, parsing of textual 
formats, writing textual formats, etc., I almost always want a traditional 
C/POSIX/ISO representation as easily provided by printf()-style specifiers. 99% 
of the time when I want to do an number-to-string (integer or otherwise) 
conversion especially, I’m being specific about the appearance of the number.

For example, for a hex representation of sockaddr_in.sin_addr.s_addr, I would 
in other languages write "printf("0x%08x", address.sin_addr.s_addr);", or 
"%02hhu" times four to get dotted-decimal notation. (Ignoring for the moment 
the existence of inet_ntop() for the sake of the example :). In Swift, I 
currently have to make a call to printf(), fprintf(), dprintf(), 
NSString(format:), asprintf() (with a wrapper to deal with getting a 
Swift.String from allocated memory), etc. A configured NumberFormatter instance 
is a great deal more code - even NumberFormatter.localizedString(from: foo, 
number: .decimal) is very verbose, and that *still* doesn’t yield the same 
level of format control!).

And to top it off, these still carry the traditional problem of printf() 
formats - separation between the format specifier and the data that format 
applies to. I’m sure most of us have at one time or another written a printf() 
with enough arguments that it was easy to lose track of them and end up being 
very grateful for the existence of -Werror=format (and frustrated that 

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

2016-06-21 Thread David Waite via swift-evolution
If such bike-shed repainting is under serious consideration, I’d request that 
the tint take into account the possibility of string formatter options being 
desired in the future. Outside of that, I’m just as happy with the current 
symbol as I would be with the proposals I’ve heard so far.

-DW

> On Jun 21, 2016, at 3:03 PM, Dave Abrahams via swift-evolution 
>  wrote:
> 
> 
> on Tue Jun 21 2016, Kenny Wyland  > wrote:
> 
>> Hi all,
>> 
>> I'm new to the list and I just searched through the archives as best I
>> could to see if someone else had already brought this up, but I didn't find
>> anything. Forgive me if this horse has been beaten.
>> 
>> 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.
>> 
>> 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'm forced to agree that \ is quite awkward for something that may be
> used so pervasively, and $ would likely meet more peoples' expectations.
> 
> -- 
> 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


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

2016-06-21 Thread Brandon Knope via swift-evolution
I agree big time. It is pretty awkward to type and I completely understand the 
angst when having to type it!

$() seems like the better option, though maybe not as nice looking as \() 
(maybe it is on second thought?) it is much easier to type!

Brandon 
 
> On Jun 21, 2016, at 5:22 PM, Saagar Jha via swift-evolution 
>  wrote:
> 
> %, at least to me, suggests distant evaluation; i.e. parameter passing at the 
> end. $ seems more like an in-place evaluation, like how bash does it.
> 
>> On Tue, Jun 21, 2016 at 2:14 PM Xiaodi Wu via swift-evolution 
>>  wrote:
>> That said, I think it's nice that \, #, $, and @ are all used in unique 
>> scenarios. What about going a little classical with %?
>>> On Tue, Jun 21, 2016 at 16:10 Dave Abrahams via swift-evolution 
>>>  wrote:
>>> 
>>> on Tue Jun 21 2016, Kenny Wyland  wrote:
>>> 
>>> > Hi all,
>>> >
>>> > I'm new to the list and I just searched through the archives as best I
>>> > could to see if someone else had already brought this up, but I didn't 
>>> > find
>>> > anything. Forgive me if this horse has been beaten.
>>> >
>>> > 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.
>>> >
>>> > 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'm forced to agree that \ is quite awkward for something that may be
>>> used so pervasively, and $ would likely meet more peoples' expectations.
>>> 
>>> --
>>> 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
> 
> -- 
> -Saagar Jha
> ___
> 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


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

2016-06-21 Thread Kurt Werle via swift-evolution
I really don't like \.  I'd prefer just about any of the shift keys
(!@#$%^&).

That said, I would shut up and cope if xCode did the right thing when you
were typing a \ inside "'s and just filled in the () and placed the cursor
in the right spot.  I guess that would upset folks that type a lot of
\otherstuff in "'s, but I could live with that.

On Tue, Jun 21, 2016 at 2:22 PM, Saagar Jha via swift-evolution <
swift-evolution@swift.org> wrote:

> %, at least to me, suggests distant evaluation; i.e. parameter passing at
> the end. $ seems more like an in-place evaluation, like how bash does it.
>
> On Tue, Jun 21, 2016 at 2:14 PM Xiaodi Wu via swift-evolution <
> swift-evolution@swift.org> wrote:
>
>> That said, I think it's nice that \, #, $, and @ are all used in unique
>> scenarios. What about going a little classical with %?
>> On Tue, Jun 21, 2016 at 16:10 Dave Abrahams via swift-evolution <
>> swift-evolution@swift.org> wrote:
>>
>>>
>>> on Tue Jun 21 2016, Kenny Wyland  wrote:
>>>
>>> > Hi all,
>>> >
>>> > I'm new to the list and I just searched through the archives as best I
>>> > could to see if someone else had already brought this up, but I didn't
>>> find
>>> > anything. Forgive me if this horse has been beaten.
>>> >
>>> > 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.
>>> >
>>> > 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'm forced to agree that \ is quite awkward for something that may be
>>> used so pervasively, and $ would likely meet more peoples' expectations.
>>>
>>> --
>>> 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
>>
> --
> -Saagar Jha
>
> ___
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>


-- 
k...@circlew.org
http://www.CircleW.org/kurt/
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-21 Thread Saagar Jha via swift-evolution
%, at least to me, suggests distant evaluation; i.e. parameter passing at
the end. $ seems more like an in-place evaluation, like how bash does it.

On Tue, Jun 21, 2016 at 2:14 PM Xiaodi Wu via swift-evolution <
swift-evolution@swift.org> wrote:

> That said, I think it's nice that \, #, $, and @ are all used in unique
> scenarios. What about going a little classical with %?
> On Tue, Jun 21, 2016 at 16:10 Dave Abrahams via swift-evolution <
> swift-evolution@swift.org> wrote:
>
>>
>> on Tue Jun 21 2016, Kenny Wyland  wrote:
>>
>> > Hi all,
>> >
>> > I'm new to the list and I just searched through the archives as best I
>> > could to see if someone else had already brought this up, but I didn't
>> find
>> > anything. Forgive me if this horse has been beaten.
>> >
>> > 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.
>> >
>> > 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'm forced to agree that \ is quite awkward for something that may be
>> used so pervasively, and $ would likely meet more peoples' expectations.
>>
>> --
>> 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
>
-- 
-Saagar Jha
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


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

2016-06-21 Thread Xiaodi Wu via swift-evolution
That said, I think it's nice that \, #, $, and @ are all used in unique
scenarios. What about going a little classical with %?
On Tue, Jun 21, 2016 at 16:10 Dave Abrahams via swift-evolution <
swift-evolution@swift.org> wrote:

>
> on Tue Jun 21 2016, Kenny Wyland  wrote:
>
> > Hi all,
> >
> > I'm new to the list and I just searched through the archives as best I
> > could to see if someone else had already brought this up, but I didn't
> find
> > anything. Forgive me if this horse has been beaten.
> >
> > 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.
> >
> > 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'm forced to agree that \ is quite awkward for something that may be
> used so pervasively, and $ would likely meet more peoples' expectations.
>
> --
> 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


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

2016-06-21 Thread Dave Abrahams via swift-evolution

on Tue Jun 21 2016, Kenny Wyland  wrote:

> Hi all,
>
> I'm new to the list and I just searched through the archives as best I
> could to see if someone else had already brought this up, but I didn't find
> anything. Forgive me if this horse has been beaten.
>
> 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.
>
> 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'm forced to agree that \ is quite awkward for something that may be
used so pervasively, and $ would likely meet more peoples' expectations.

-- 
Dave

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


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

2016-06-21 Thread Jonathan Cotton via swift-evolution
I'd support $() as is in use by other languages, including Kotlin, as mentioned 
it seems less disruptive and more inline with the tokenised parameters that are 
already supported in closures.

> On 21 Jun 2016, at 21:43, Kenny Wyland via swift-evolution 
>  wrote:
> 
> Hi all,
> 
> I'm new to the list and I just searched through the archives as best I could 
> to see if someone else had already brought this up, but I didn't find 
> anything. Forgive me if this horse has been beaten.
> 
> 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. 
> 
> 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). 
> 
> Thoughts?
> 
> Kenny Wyland
> InADayDevelopment.com
> ___
> 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