News for hackers. Stuff that matters.
Re:Go generics may use square brackets [] not parenthesis () by chmod775 on Tuesday July 14, 2020 @10:24PM (#23840516)
>A typical computer keyboard provides four easily accessible pairs of single-character symmetrical "brackets"

"falsehoods programmers believe about keyboards"

On the keyboard layouts of many countries these keys aren't accessible at all, either missing entirely or only being accessible via unergonomic key combinations.

For this reason myself (and many other programmers) own additional ANSI-US layout keyboards.

Re:Go generics may use square brackets [] not parenthesis () by Akronymus on Wednesday July 15, 2020 @05:30AM (#23842970)
QWERTZ here. I need to use the following key combinations:

shift + 8 -> (

shift + 9 -> )

alt + ctrl + 8 -> [

alt + ctrl + 9 -> ]

alt + ctrl + 7 -> {

alt + ctrl + 0 -> }

Alternatively alt + ctrl can be replaced by altgr.

And for further fun:

alt + ctrl + ß -> \

shift + 0 -> =

shift + 7 -> /

Actually, it is probably easier to link the whole layout: https://de.wikipedia.org/wiki/DIN_2137#/media/Datei:Deutsche...

It is pretty bad for programming in languages that make heavy usage of braces/brackets/parenthesis.

Re:Go generics may use square brackets [] not parenthesis () by pantalaimon on Wednesday July 15, 2020 @09:25AM (#23844854)
> Alternatively alt + ctrl can be replaced by altgr.

What operating system are you on? I can only create those with AltGr, anything shift-alt will be interpreted as a keyboard shortcut.

Re:Go generics may use square brackets [] not parenthesis () by Akronymus on Wednesday July 15, 2020 @09:42AM (#23845073)
Win 10.

Are you maybe confusing alt ctrl with alt shift? Your comment seems to indicate it as that being the case.

Re:Go generics may use square brackets [] not parenthesis () by himinlomax on Wednesday July 15, 2020 @09:37AM (#23845019)
That's why I switched to Qwerty 20 years ago (from Azerty); I used caps lock as a compose key for diacritics. Makes it easier to type common signs such as ≤ → ≠ Ø
Re:Go generics may use square brackets [] not parenthesis () by 9HZZRfNlpR on Wednesday July 15, 2020 @02:23PM (#23849424)
Same here, I only use US layout, but caps lock mapped to compose the keys my native language needs. They are mapped to the same place I left them 10 yrs ago, it was easier the beginning.
Re:Go generics may use square brackets [] not parenthesis () by rk06 on Wednesday July 15, 2020 @06:24AM (#23843312)
at that point, you might as well buy a QWERTY keyboard
Re:Go generics may use square brackets [] not parenthesis () by riffraff on Wednesday July 15, 2020 @08:07AM (#23844018)
I have a QWERTY keyboard but with italian layout, and the special characters are also in different places[0].

I have

* <shift>+<8,9> for (,)

* <altgr>+<è> for [

* <altgr>+<+> for ]

* <altgr>+<shift>+<è> for }

* <altgr>+<shift>+<+> for }

yes, it's a pain to use some languages.

[0] https://en.wikipedia.org/wiki/QWERTY#Italian

Re:Go generics may use square brackets [] not parenthesis () by qalmakka on Wednesday July 15, 2020 @09:40AM (#23845047)
Add to that the fact that typing ~ and ` is impossible with the standard it layout (on X11 you can using platform-specific extra key combinations, such as `AltGr` + `+` if I recall correctly, while on Windows you must use ALT codes). So pleasant...

Also, random rant, the IT keyboard layout is moronic because on most platforms inputting accented uppercase letters is not possible in any way. Ironically, 'c with cedilla', section sign `§`, degree sign and the now unused pound sign are present on every key and easily typed using shift.

I've been arguing since the dawn of time that "US with dead keys" is a vastly better keyboard layout for Italian than the Italian one, and that's the one I use (more correctly, I use US International with AltGr keys due to the fact I type accented letters less frequently than I type single quotes or backticks).

Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @06:34AM (#23843373)
Everyone in our field should do themselves a favor and learn to touch-type regardless of the physical keyboard.
Re:Go generics may use square brackets [] not parenthesis () by rmetzler on Wednesday July 15, 2020 @06:55AM (#23843516)
I agree, but this doesn’t has anything to do with the keyboard layout, except that if you need to switch layouts regularly, touch-typing doesn’t get easier.

The thread is about the accessibility of some brackets on German QWERTZ keyboard layouts. These curly brackets aren’t even printed on some external Apple keyboards. And if you try to type them with one hand, you would need to turn your wrist in some unnatural position. That’s the main reason why I use an US QWERTY keyboard for the last 15 years.

Re:Go generics may use square brackets [] not parenthesis () by qalmakka on Wednesday July 15, 2020 @09:44AM (#23845093)
Umlaut vowels and ß are easy to input using the US international keyboard layout (with dead keys/AltGr combinations). I'm Italian, I study German and I find extremely convenient being able to easily input both àèéìòóù and äëöü without having to learn a second layout and switching.
Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @10:07AM (#23845401)
I am quite a good touch typists and that makes it so difficult for me, to switch layouts. Once your muscle memory is hard wired, you cannot arbitrarily change things. Last time I had to type on English layouts, it reduced my ability to touch-type greatly.
Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @11:52AM (#23847018)
Well that's exactly my point. Pick a layout and stick to it. Regardless of what's printed on the keys.
Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @12:01PM (#23847142)
Right, that's what I did. I stuck with the German layout, as this allows me to use my native language too. But his means, certain characters, like brackets, are more difficult to type and thus the assumption, that everyone is using an (US) English keyboard is a wrong one.

But in a general sense, I fully agree to your statement. Learning to touch type was an extremely valuable skill to acquire and I can only recommend it to everyone.

Re:Go generics may use square brackets [] not parenthesis () by Lev1a on Wednesday July 15, 2020 @06:48AM (#23843462)
I did a few years back during uni[1] and I'm pretty sure that's still my most used skill I learned there.

[1]: Decided one day to get myself one of those little booklets with training software on CD. I then slowly stepped through the training steps (each step more letters and more repitition of already learned ones) and got decent at touch-typing by forcing myself to use it more and more in everyday uni life. Took about one or two months to get up to a level usable in general typing (writing for reports/homework AND programming) with little to no pauses or errors.

Re:Go generics may use square brackets [] not parenthesis () by divingdragon on Wednesday July 15, 2020 @07:13AM (#23843627)
This doesn't help with some of the difference between ANSI and ISO layouts. For example ANSI uses a long Enter key while ISO uses one that looks like the shape of a "7".
Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @07:19AM (#23843671)
ISO has one extra key, that's it.

I only buy ANSI keyboards and like the layout better (both Enter and left Shift are easier to reach) but I occasionally get to type on ISO keyboards, it's not too bad.

Re:Go generics may use square brackets [] not parenthesis () by Akronymus on Wednesday July 15, 2020 @06:50AM (#23843482)
I tried to learn the qwerty layout before, but my muscle memory is so ingrained that it was impossible for me at the time.

And without correct keycaps it is even harder.

Re:Go generics may use square brackets [] not parenthesis () by Lio on Wednesday July 15, 2020 @07:45AM (#23843843)
About 11 years ago (I think) I switched to the Colemak layout. It's a pain to switch at first but you do quickly get used to it.

That forced me to always touch type, a good thing. It also has the advantage that the layout is pretty consistent across physical keyboard layout.

That's not the case for UK Qwerty; UK Apple is different to UK ISO is different (obviously) to ANSI. Where as Colemak is pretty consistent. So it's been helpful when moving between machines and OSs.

...it's also been the generator of hilarious memories, such as when someone changes their layout to Colemak for me to type something and then we logout their machine and discover they can't type their password or change layout back to Qwerty. Ah, good times...

Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @06:59AM (#23843545)
Not being able to look at the keyboard is actually a good way to learn.

Of course you'll have to fight your muscle memory and type at 20 wpm for a couple weeks. There's no shortcut.

Re:Go generics may use square brackets [] not parenthesis () by Akronymus on Wednesday July 15, 2020 @07:03AM (#23843570)
My problem is that I need to be able to check where the keys are to be able to learn it in the first place. I can touch type quite well, just not type at all in a layout I never used before, without being able to look at the keys.
Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @07:17AM (#23843655)
Print out the layout and put it under your monitor while you learn.
Re:Go generics may use square brackets [] not parenthesis () by Akronymus on Wednesday July 15, 2020 @08:40AM (#23844312)
That is such a good idea that I missed it for being so simple.
Re:Go generics may use square brackets [] not parenthesis () by Akronymus on Wednesday July 15, 2020 @06:55AM (#23843521)
I seem to be unable to find qwerty keycaps for a g513 without having to buy a completely new keyboard. So, for me it is not really an option.
Re:Go generics may use square brackets [] not parenthesis () by 1-more on Wednesday July 15, 2020 @11:16AM (#23846391)
Inspired by the space cadet keyboard, I have (){}<> as hold/tap on my modifiers. It vastly improves my coding experience.
Re:Go generics may use square brackets [] not parenthesis () by tgb on Wednesday July 15, 2020 @07:52AM (#23843896)
Are parentheses not used in daily writing in your language?
Re:Go generics may use square brackets [] not parenthesis () by ynik on Wednesday July 15, 2020 @09:20AM (#23844791)
DE shift+8/9 is only slightly worse than US shift+9/0 for parens. Brackets+Braces are the real problem on DE layout. I switched between US (programming) and DE (writing German) for a couple years; but then ended up using US-intl-no-dead-keys everywhere because the constant switching of input methods was annoying (especially due to Y/Z being swapped on DE, which causes confusion between undo/redo).
Re:Go generics may use square brackets [] not parenthesis () by brazzy on Wednesday July 15, 2020 @09:22AM (#23844812)
They are, but so are ä, ö, ü, Ä, Ö, Ü, and ß.
Re:Go generics may use square brackets [] not parenthesis () by hombre_fatal on Tuesday July 14, 2020 @10:47PM (#23840654)
I don't think this is very notable since these brackets are already present in Go and almost every other language.
Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @10:09AM (#23845426)
Yes, they are, and for me they are distinctly more difficult to type than parens.
Re:Go generics may use square brackets [] not parenthesis () by jefft255 on Tuesday July 14, 2020 @10:47PM (#23840655)
I typically use French Canadian layout keyboards, and quickly switch to US with Win+Space when programming and switch back for regular typing.

I never felt like owning a new keyboard was necessary as a memorized the keys fairly quickly. The CA-FR layout is QWERTY+accents, but () {} etc. are weirdly placed, some requiring the use of the “alt-car” key which I’m not even sure exists in the US layout. I really hate programming or using vim in that layout.

Are there layouts where that approach isn’t feasible? Or is it mostly a memorization issue?

Re:Go generics may use square brackets [] not parenthesis () by chmod775 on Wednesday July 15, 2020 @12:40AM (#23841389)
>Are there layouts where that approach isn’t feasible? Or is it mostly a memorization issue?

You can adapt most of the western layouts to at least get "[]{}" in easily accessible places, but for instance trying to adapt a German layout can get really confusing. Have a look at this typical German layout:

https://upload.wikimedia.org/wikipedia/commons/thumb/3/36/KB...

So we can remap "{}[]" to somewhere next to the enter key, ideally by moving the "+" key to the upper row. We also want to remap "|" and probably "<>" somewhere next to the enter key, because typing those a lot also gets awkward in their former spot. You could compensate by the entire bottom letter row to the left, arriving at something close to US-ANSI.

Needless to say, that's going to get really confusing. I'm a touch typist, but if I'd already have trouble, I don't want to imagine what that's going to be like for someone who is not.

Personally I just use an ANSI-US layout keyboard with a few custom shortcuts for typing ä, ö and ü. I can get away with this because I don't need to write a lot of German text.

For someone who has to switch between layouts to be efficient in both writing German text and code, it's probably better to use physically different keyboards so it's easier to build muscle memory.

Re:Go generics may use square brackets [] not parenthesis () by Tainnor on Wednesday July 15, 2020 @04:54AM (#23842776)
I'm originally Swiss, so I use the Swiss keyboard layout, which is much better when it comes to bracket placement: https://commons.m.wikimedia.org/wiki/File:KB_Swiss.svg

Except on a mac, because for some reason the mac layout is totally different, which is why I need to use a key remapper on my work computer.

Re:Go generics may use square brackets [] not parenthesis () by hibbelig on Wednesday July 15, 2020 @06:22AM (#23843302)
I guess most European languages with Latin letters "with adornments" can be written quite nicely with a keyboard layout similar to US Intl.

You can write the characters using digraphs.

For example, type <"> and then <a> to get <ä>. Type <"> and then <space> to get <">.

This won't work for other alphabets, of course.

Not sure what CJKV users do.

Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @07:13AM (#23843632)
> Not sure what CJKV users do.

Chinese: the physical layout is always ANSI US. Depending on the IME you might want more than roman characters printed on keycaps, but it's just cosmetic if you can touch-type.

Japanese: most keyboards use the JIS layout and visually support multiple IME, but if you stick to romaji, using an ANSI US keyboard works too.

Korean: the physical layout is ANSI US (sometimes with 2 extra modifiers). Hangul is a proper alphabet, symbols are made up of subcomponents (jamo) that are printed on the keys. Again it's just cosmetic.

In my experience, people of my generation (30-40 years old) who are educated know to touch-type. For instance I've never met a Taiwanese that needed to look at the Zhuyin symbols on a keyboard.

But I've heard that's not the case anymore with kids that grew up using smartphones.

Re:Go generics may use square brackets [] not parenthesis () by tgb on Wednesday July 15, 2020 @08:03AM (#23843978)
Just to expand on this, at least in Mandarin, one types out phonetic Latin alphabet-based pinyin and the system prompts you with choices of matching symbols in the same way that predictive keyboards show you words. You select which characters to insert by clicking/tapping on them or hitting a number key. The only big difference is that the same pinyin might correspond to any number of characters and you might have to search through a lot, but context and frequency helps it suggest the right ones to you. (Mandarin only has 409 different pinyin 'syllables' when ignoring tones, which aren't typed in this system. Even with tones, there's only like 1200. These map to many thousands of characters, obviously not one-to-one. Depending on how you count, English has something like 16000 syllables.)
Re:Go generics may use square brackets [] not parenthesis () by brazzy on Wednesday July 15, 2020 @09:40AM (#23845056)
Works pretty the same in Japanese, they just have their own syllabic scripts (two of them), but the entry method can support them as well.
Re:Go generics may use square brackets [] not parenthesis () by hibbelig on Wednesday July 15, 2020 @12:09PM (#23847274)
Based on the pinyin based Chinese input method I've seen, I guess the user will want to switch to US for entering code, right? Otherwise, the IME will offer Chinese characters...

What I like about using US Intl (I've modified it slightly) is that no switching is required, I can conveniently enter both the programming related characters (such as curly braces which require gymnastics with a German keyboard layout) and the German specific characters such as umlauts.

But I can't imagine that this could be possible for Chinese without switching modes (or input methods or keyboar layouts).

Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @06:27AM (#23843328)
Why not switch between US and US international? No need to learn two layouts and where accents are located.
Re:Go generics may use square brackets [] not parenthesis () by jefft255 on Wednesday July 15, 2020 @09:12AM (#23844674)
We all learn to type on CA-FR keyboards, so using US-INT would require me to learn yet another layout for accents. Plus CA-FR is the one actually printed on keycaps everywhere; using US-INT for accents would be counter-productive.
Re:Go generics may use square brackets [] not parenthesis () by ynik on Wednesday July 15, 2020 @09:27AM (#23844880)
Or use US international without dead keys. No need to switch when you can just use right alt for the non-ASCII characters.
Re:Go generics may use square brackets [] not parenthesis () by Macha on Wednesday July 15, 2020 @06:16AM (#23843266)
Cases where ` 's are used for quoting are a big example of this. Typing `example` turns into èxample` on my keyboard because the backtick key is a modifier for the next press. To type `example`, I need to type:

* On Linux: ``example`

* On Windows: ``<left>example

Some editors even turn the latter into ```` when I double press the backtick as no symbol renders prior to that.

Re:Go generics may use square brackets [] not parenthesis () by waldfee on Wednesday July 15, 2020 @06:30AM (#23843346)
at least for windows you can change the keyboard layout to directly output the deadkeys, example for german: https://github.com/RAnders00/Deutsch-ohne-Tottasten

if none is available for your language you can build it yourself: https://zauner.nllk.net/post/0014-windows-no-dead-keys/

Re:Go generics may use square brackets [] not parenthesis () by danaliv on Tuesday July 14, 2020 @11:01PM (#23840741)
This struck me too. Writing code on an Icelandic keyboard is an awful experience.
Re:Go generics may use square brackets [] not parenthesis () by signal11 on Wednesday July 15, 2020 @07:55AM (#23843912)
Looking at the Icelandic layout[1] from a programmers' perspective, the big difference appears to be that \, [, and ] need a modifier, Alt-Gr; and ; (semi-colon) is shifted.

The shifted semi-colon must be irritating in C-like languages, but even on US/UK keyboards, characters like ( and { need Shift, which admittedly is larger than Alt-Gr and there are two of them.

I wonder if the larger right Shift key can be mapped as Alt-Gr.

PS. Does Icelandic need the letter 'mu' often enough to dedicate a key to it on the keyboard?

[1] https://en.wikipedia.org/wiki/Icelandic_keyboard_layout#/med...

Re:Go generics may use square brackets [] not parenthesis () by tirpen on Wednesday July 15, 2020 @10:02AM (#23845328)
μ is used a fair bit by anyone who uses the metric system, so it makes sense to include it. It's used as a prefix to denote a millionth for those that don't know, as in µm = micrometer = a millionth of a meter.

It's mapped to Alt-Gr+M on Swedish keyboards as well, but I've never seen a keyboard where it's actually written on out on the key.

Re:Go generics may use square brackets [] not parenthesis () by IceDane on Wednesday July 15, 2020 @01:06PM (#23848124)
> A fair bit by anyone who uses the metric system?

I'm sorry, but what?

Most people who use the metric system can't tell you which is smaller: micro or milli. Most people will never encounter anything in their lifetime they will actually need to reason about in some important manner that is measured in μ-anything.

As a user of the Icelandic layout I wasn't even aware that the key was on there, but I can confirm that we absolutely don't need it. I think there are probably a lot of keyboard layouts that could use modernizing wrt. how they are actually used today.

Re:Go generics may use square brackets [] not parenthesis () by Symbiote on Wednesday July 15, 2020 @01:57PM (#23849019)
µ would be used by scientists, engineers, doctors and nurses.

That doesn't seem unreasonable, when we have <, >, { and } for mathematics, \ originally for logicians (to combine to make /\ AND and \/ OR) and |, @, _ and # for programming.

Re:Go generics may use square brackets [] not parenthesis () by IceDane on Wednesday July 15, 2020 @01:01PM (#23848062)
Shifted semicolon is absolutely a non-issue. If there are any problems with the layout, it's hiding the symbols behind altgr, but the shifted semicolon is really not a problem.
Re:Go generics may use square brackets [] not parenthesis () by Symbiote on Wednesday July 15, 2020 @02:01PM (#23849087)
I think if my mother tongue wasn't English, and I therefore regularly typed on a different European layout, I'd remap the left Windows key or maybe Caps Lock to be an additional AltGr.
Re:Go generics may use square brackets [] not parenthesis () by IceDane on Wednesday July 15, 2020 @01:00PM (#23848036)
I disagree. I have been writing code with the icelandic layout for over 20 years and it has really never been an issue for me. You put your right thumb on altgr and hit the number keys.
Re:Go generics may use square brackets [] not parenthesis () by ulucs on Wednesday July 15, 2020 @08:37AM (#23844279)
I think it is reasonable that programmers should be able to modify their keyboards to have easier access to useful keys, ie all the caps lock-esc stuff.

Btw, Microsoft Keyboard Layout Creator is a terrific tool. I spent around 10 minutes sω tφαθ İ cöüλδ tyπε lıκε δiş. (Turkish characters accessible through AltGr and Greek characters accessible through a dead key) And if you look at the config files (some kind of tab separated values with comments), the created keyboards are easily sharable and combinable.

Re:Go generics may use square brackets [] not parenthesis () by account42 on Wednesday July 15, 2020 @11:03AM (#23846176)
> For this reason myself (and many other programmers) own additional ANSI-US layout keyboards.

Why though when you can change layouts without changing keyboards.

Re:Go generics may use square brackets [] not parenthesis () by kace91 on Wednesday July 15, 2020 @11:46AM (#23846912)
Several reasons (I'm not op).

The main one is that you might not know the placement of the keys of the US layout by heart so having your printed keyboard match the layout is best. I'm a touch typist, but I still look from time to time to find things like | or ~.

Also, your physical layout might be slightly different, then finding the right key becomes a matter of trial and error for some edge cases (think the inverted L shaped enter key vs the long rectangle version).

Re:Go generics may use square brackets [] not parenthesis () by IceDane on Wednesday July 15, 2020 @12:53PM (#23847940)
The last point has nothing to do with the language really. At least not the shape of the enter key. On Nordic layouts you usually have an extra key left of Z for angle brackets.

There really is no reason to switch between actual physical keyboards to use a different keyboard layout, even if you need to look at the keys(and it would still require you to switch layouts in software). Surely googling a layout cheat sheet is easier than switching keyboards.

Re:Go generics may use square brackets [] not parenthesis () by kace91 on Wednesday July 15, 2020 @02:10PM (#23849231)
> There really is no reason to switch between actual physical keyboards to use a different keyboard layout, even if you need to look at the keys(and it would still require you to switch layouts in software). Surely googling a layout cheat sheet is easier than switching keyboards.

In my case, more than switching, it's that my laptop has a spanish set (work provided), and I went through the trouble of buying an external one with an English layout. It's not like I'm switching between them every few minutes, the Spanish one is left unused. I don't even bother switching layouts, since I can perfectly write Spanish with the English layout (the only missing keys are accents, which I omit in informal texts, and the ñ key that I can get long pressing the n).

I could use the Spanish one and look at a cheat sheet from time to time, but it's inconvenient enough that the 40 extra bucks feel like a good inversion.

Re:Go generics may use square brackets [] not parenthesis () by djhaskin987 on Tuesday July 14, 2020 @10:53PM (#23840693)
Programming is almost always conducted in English, even if the application itself as well internationalized and can be used from different languages. Even API documentation is almost always written in English regardless of the country of origin of the author. The only exception I can see to this rule is programs and docs written in China.

Everywhere else, it's reasonable to assume that if you're a programmer, you speak English and likely have an English keyboard. This may not be fair, but it is the state of affairs.

You likely own a US keyboard not only for the parentheses problem, but because of all sorts of English isms throughout all code -- alphanumerics, urls, etc are all in Latin script. It's like German in the field of mathematics in the 19th century.

Re:Go generics may use square brackets [] not parenthesis () by GolDDranks on Tuesday July 14, 2020 @10:59PM (#23840732)
It's reasonable to assume that you speak English, but not so reasonable to assume that you have an English (US or UK, for example) keyboard. Basically all of us have keyboard with Latin letters, that are perfectly up to the task of writing "normal" English, but the seldom used braces and brackets are behind some alt-gr shenanigans.

Yes, they are symbols that are used in many programming languages. No, it's not reasonable to assume that they are easy to type for all of us.

Re:Go generics may use square brackets [] not parenthesis () by dgellow on Tuesday July 14, 2020 @11:42PM (#23841056)
I don’t get your issue with modifiers such as alt-gr. I grew up with a mix of Swiss (swiss qwertz) and French layout (azerty), and have my own custom layout since around 10 years, all of them require to use modifiers just to write my main languages and that hasn’t been an issue since I was a kid. If you use a non US layout it’s very likely that you already use modifiers quite often, I don’t understand why that would become an issue once you start writing code.
Re:Go generics may use square brackets [] not parenthesis () by mantap on Tuesday July 14, 2020 @11:13PM (#23840804)
It is reasonable to assume that anybody writing code is using the US keyboard layout. That is the de facto standard and standards are important.

Anybody who deviates from that is doing so at their own risk. If you want to use Dvorak or Azerty instead of Qwerty then you can do that, it's just not advisable because things like Vim will no longer make sense.

If you try to write code using a layout that doesn't have all the ascii printable symbol characters in accessible locations then you're creating a special kind of hell for yourself. It takes like 30 seconds to change to US layout.

Re:Go generics may use square brackets [] not parenthesis () by dgellow on Tuesday July 14, 2020 @11:34PM (#23840989)
> It is reasonable to assume that anybody writing code is using the US keyboard layout. That is the de facto standard and standards are important.

That’s not reasonable at all. You have way more people writing code outside of the US than within. The US layout may be the most represented one, I don’t know statistics on this, but I would expect it to be on the losing side when comparing US layout vs non-US layout.

Though I would agree that having access to ASCII is something you need, but any standardized keyboard layout in the world can do that via modifiers, if not directly.

Re:Go generics may use square brackets [] not parenthesis () by setr on Wednesday July 15, 2020 @03:21AM (#23842254)
Its reasonable in the sense that the decision was already made, by history & circumstance, and that it's largely not that problematic and well supported (out of necessity).

The only alternatives would be to converge on a lowest common demoninator, and have a likely more inconvenient syntax for all parties, or to diverge into regional-specific dialects, which unicode shows to be.. wide.. and generally make code sharing much harder.

This is really more of a "many mostly equivalent solutions, but one needs to be picked" scenario -- and it would be time poorly spent trying to undo the incumbent solution (and will naturally be rendered untenable by endless bike-shedding anyways). The worst of all solutions -- except for all the others

Re:Go generics may use square brackets [] not parenthesis () by YawningAngel on Wednesday July 15, 2020 @08:17AM (#23844104)
Lots of non-US based programmers use a US layout anyway though, so I think it's a pretty reasonable assumption in the context of English language programming
Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @08:44AM (#23844355)
No, it is not reasonable. While, as you can see, I am fine using English, I have to use a German keyboard layout because otherwise I would lose the ability to type my native language.
Re:Go generics may use square brackets [] not parenthesis () by account42 on Wednesday July 15, 2020 @11:05AM (#23846213)
There is nothing preventing you from swtiching layouts between coding and typing German.
Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @11:10AM (#23846288)
Yes, there is: I am a touch-typist. So the layout of the keyboard is wired into my muscle-memory. Trying to switch layouts wrecks havoc with that. I tried it for a while, when I had to use an English layout at work, and it was very detrimental to my typing abilities. So I had to decide on one layout, and my native tongue won. As you see, I can type English text quite fine, just the brackets are more painful to type than parens.
Re:Go generics may use square brackets [] not parenthesis () by account42 on Thursday July 16, 2020 @04:04AM (#23856848)
How long did you try? Of course learning to touch type on a different layout will take some time but that doesn't make using brackets in programming languages unreasonable.

Using a German layout is very much a choice you have made and is no reason for you to demand that programming languages should make everyone else's life harder to acomodate those choices. Even for German text input, umlauts and sz are rare enough that it is not much of a hindrance to have to enter those via dead keys or compose sequences on a layout that doesn't make {} and [] a pain to type.

Re:Go generics may use square brackets [] not parenthesis () by IceDane on Wednesday July 15, 2020 @12:56PM (#23847986)
I don't think that's reasonable to think at all. Literally no one I know locally that is also a programmer uses the American layout. The difficulties of inputting symbols with ex. altgr is overstated.

I really don't think most people use the American layout. That's just typical america-centric narcissism.

Re:Go generics may use square brackets [] not parenthesis () by alkonaut on Wednesday July 15, 2020 @04:38AM (#23842681)
I speak Swedish and code/message/email in English for work, but I still need to type Swedish occasionally so my keyboard is Swedish both in hardware (layout) and software (mapping).

Curly brackets etc use hand-twisting alt-gr combinations on a Swedish layout so I’d be better off using a US keyboard mapping so I can type ([{ using only shift. I have tried and failed to make that switch. It would probably just slow me down for a month or so before it made me faster, but I’ll keep pushing my square-wheeled cart thank you.

Re:Go generics may use square brackets [] not parenthesis () by rightbyte on Wednesday July 15, 2020 @06:30AM (#23843342)
I have tried too and I gave up. It made my head hurt and you are not really getting the US layout anyway.
Re:Go generics may use square brackets [] not parenthesis () by OskarS on Wednesday July 15, 2020 @07:05AM (#23843583)
I created an Emacs minor mode to make the ö/ä keys type square/curly brackets, but it’s not ideal.
Re:Go generics may use square brackets [] not parenthesis () by sneak on Tuesday July 14, 2020 @11:14PM (#23840811)
Unfortunately this is not the case. Many, many people use laptops, and getting laptops with non-local keyboard layouts is Really Quite Difficult. You usually have to go to the place where the layout is native to buy it.

External keyboards, sure. But many of us are laptop-only.

Sure, you can remap the keys, but also, not everyone is a touch typist.

Re:Go generics may use square brackets [] not parenthesis () by sacado2 on Wednesday July 15, 2020 @05:39AM (#23843028)
Even if your code is written in English, some text still has to be written in your own language (in particular, anything the end user will happen to read). And, although you can write English from a (say) French keyboard, writing French from an English keyboard is a PITA.
Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @06:31AM (#23843351)
> writing French from an English keyboard is a PITA.

There's no English keyboard.

Writing French with the US international layout is actually pretty easy.

Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @08:47AM (#23844386)
There are US English and English UK keyboards, both a very similar, and very dissimilar from French and German keyboards. I would challenge you to tell me how you type the following letters "easily" on an US international keyboard: ä ö ü ß.
Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @12:09PM (#23847282)
https://en.wikipedia.org/wiki/British_and_American_keyboards...

The umlaut is a dead key so it's very easy. ß is AltGr or Option + S which I admit is a bit more annoying, but your spellchecker should take care of that, no? (I'm Swiss so even when I have to type in broken German, we don't use the ß here).

All layouts are tradeoffs. Not using the US layout makes a lot of things annoying in our field. I write code and use my IDE's keyboard shortcuts more than I need to write long texts in my native language.

Re:Go generics may use square brackets [] not parenthesis () by sacado2 on Wednesday July 15, 2020 @11:05AM (#23846205)
There are many diacritics in French, and not having a key for the most frequent accentuated letters is far from optimal (for instance, the previous sentence in French would contain 5 diacritics).
Re:Go generics may use square brackets [] not parenthesis () by hocuspocus on Wednesday July 15, 2020 @11:49AM (#23846958)
You'll never find an optimal layout, they're all compromises.

I've switched to US intl 15 years ago and I don't type in French any slower than I used to. On the other hand I benefit greatly from using the default layout in our very US-centric field.

Re:Go generics may use square brackets [] not parenthesis () by LandR on Wednesday July 15, 2020 @10:02AM (#23845326)
If I set my layout to US then @ and " swap.

So " is Shift+' and @ is shift+2

In UK keyboard layout, @ is shift+', and " is shift+2 (which is what is shown on my keyboard keys).

Re:Go generics may use square brackets [] not parenthesis () by orthoxerox on Wednesday July 15, 2020 @11:17AM (#23846399)
Can you imagine how Russians and Bulgarians deal with it? Yes, they switch layouts all the time. Write some lines of code in English, switch to Russian or Bulgarian to write comments or reply in Slack.
Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @08:43AM (#23844335)
No, it is not reasonable to assume that people, who are fine at speaking English, are using an English keyboard layout. I am using a German keyboard layout, as I want to be able to use my native language, and that is not possible with an English layout. However, as I am a touch-typist, I cannot switch keyboard layouts frequently, so I have to go with the German one.
Re:Go generics may use square brackets [] not parenthesis () by heavenlyblue on Wednesday July 15, 2020 @08:47AM (#23844391)
I can touch-type in Russian and English layouts.

My favorite keyboard is British up to the point of me specifically picking a laptop/physical keyboard with a British layout.

Just learn both and you'll be OK.

Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @10:04AM (#23845356)
Lucky for you, that you managed to learn to touch type on the different layouts. It might help though, that Russian and English are entirely different layouts. The problem with German and English layouts is, that they are mostly identical, and only about 10% of them differ. This makes it very difficult to master both layouts at the same time. I tried it for a while, when I had to use an English layout temporarily. My experience was, that it thoroughly made my typing worse on both layouts.
Re:Go generics may use square brackets [] not parenthesis () by heavenlyblue on Wednesday July 15, 2020 @10:25AM (#23845607)
I've got friends who used the phonetic version of Russian keyboard where about 80-90% of the letters are going to be similar phonetically. All of them can touch-type by now.

The thing with touch-typing is that you don't think so you have to go through a period of discomfort.

Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @11:01AM (#23846133)
I am very proficient with touch typing. But in my experience, mixing German and English keyboards erroded my skills considerably.
Re:Go generics may use square brackets [] not parenthesis () by Narishma on Wednesday July 15, 2020 @01:24PM (#23848407)
I regularly switch between American and French layouts. I don't think it's particularly hard.

Edit: If that wasn't clear, I meant that I touch-type on both layouts quite easily.

Re:Go generics may use square brackets [] not parenthesis () by R0b0t1 on Wednesday July 15, 2020 @01:15PM (#23848266)
I've long desired a language that uses only alphanumeric characters and whitespace with minimal punctuation. Kind of a cross between Haskell and Delphi.
Re:Go generics may use square brackets [] not parenthesis () by faitswulff on Tuesday July 14, 2020 @10:36PM (#23840583)
TIL! Does your default keyboard have the usual round parentheses?
Re:Go generics may use square brackets [] not parenthesis () by shultays on Wednesday July 15, 2020 @12:39AM (#23841383)
They probably still exist but harder to type/require some kind of key combination. The reason to move them is not because they are not used (although in some languages probably it is) but they are less used than the additional characters in those languages
Re:Go generics may use square brackets [] not parenthesis () by aabbcc1241 on Wednesday July 15, 2020 @05:19AM (#23842899)
At least you can use gucharmap or other unicode lookup tools to get those characters
Re:Go generics may use square brackets [] not parenthesis () by hu3 on Tuesday July 14, 2020 @10:39PM (#23840603)
You can't please everyone. So might as well pick the most common keyboard layout among your users and call it typical computer keyboard.

I'm afraid there's no easy solution to this problem but I'd like to hear your suggestion.

Re:Go generics may use square brackets [] not parenthesis () by whatshisface on Tuesday July 14, 2020 @10:45PM (#23840640)
Well, there's always

   begin
and

   end

Isn't there? ;)
Re:Go generics may use square brackets [] not parenthesis () by deathanatos on Wednesday July 15, 2020 @12:43AM (#23841408)
Or… indentation! crowd gasps; lightning flashes; thunder claps; maniacal laughter is heard in the distance
Re:Go generics may use square brackets [] not parenthesis () by hu3 on Wednesday July 15, 2020 @07:45AM (#23843842)
generics with begin and end?
Re:Go generics may use square brackets [] not parenthesis () by asa4akj on Wednesday July 15, 2020 @09:03AM (#23844566)
Well, Haskell uses just a space.
Re:Go generics may use square brackets [] not parenthesis () by riffraff on Wednesday July 15, 2020 @08:18AM (#23844121)
I think Ada does something like that (type T is array of I with E) but yeah, I wouldn't advocate that :)
Re:Go generics may use square brackets [] not parenthesis () by _ph_ on Wednesday July 15, 2020 @10:17AM (#23845520)
There is no easy solution to the problem, so no one should pretend there is. Yes, if I program in Go, I have to type square brackets [] from time to time for slices. But for me it is more painful, so I strongly prefer the generics notation with parens ().

It may be, that in the end the parens are the solution to use, but at least it should be considered in the discusion, that they are not very easy to use for a lot of non-English layouts. Just assuming anyone in the world would use an English layout, is quite offensive in my eyes.

Re:Go generics may use square brackets [] not parenthesis () by coldtea on Tuesday July 14, 2020 @10:57PM (#23840718)
>On the keyboard layouts of many countries these keys aren't accessible at all, either missing entirely or only being accessible via unergonomic key combinations

Not really relevant, as we're talking about keyboards and setups used by programmers.

If they don't know how to change the layout in English to program, then perhaps they're not fit for the job.

(Non ASCII/US programmer here).

Re:Go generics may use square brackets [] not parenthesis () by pjmlp on Wednesday July 15, 2020 @07:09AM (#23843611)
Except there is this little thing called documentation and user manuals that one has to write on our native languages, yes even code comments.
Re:Go generics may use square brackets [] not parenthesis () by orthoxerox on Wednesday July 15, 2020 @11:19AM (#23846433)
There's this little thing called Alt+Shift.
Re:Go generics may use square brackets [] not parenthesis () by pjmlp on Wednesday July 15, 2020 @01:05PM (#23848113)
Indeed, doesn't make any less painful, though.