12 ms·
>A typical computer keyboard provides four easily accessible pairs of single-character symmetrical "brackets" "falsehoods programmers believe about keyboards"
by chmod775 6y ago
>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.
- faitswulff 6y agoTIL! Does your default keyboard have the usual round parentheses?
- shultays 6y agoThey 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
- aabbcc1241 6y agoAt least you can use gucharmap or other unicode lookup tools to get those characters
- hu3 6y agoYou 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.
- whatshisface 6y agoWell, there's always begin and end Isn't there? ;)
- deathanatos 6y agoOr… indentation! crowd gasps; lightning flashes; thunder claps; maniacal laughter is heard in the distance
- hu3 6y agogenerics with begin and end?
- _ph_ 6y agoThere 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.
- hombre_fatal 6y agoI don't think this is very notable since these brackets are already present in Go and almost every other language.
- _ph_ 6y agoYes, they are, and for me they are distinctly more difficult to type than parens.
- jefft255 6y agoI 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?
- chmod775 6y ago>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_Germany.svg/1920px-KB_Germany.svg.png 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.
- Tainnor 6y agoI'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 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.
- djhaskin987 6y agoProgramming 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.
- GolDDranks 6y agoIt'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.
- mantap 6y agoIt 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.
- dgellow 6y ago> 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.
- coldtea 6y ago>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).
- pjmlp 6y agoExcept there is this little thing called documentation and user manuals that one has to write on our native languages, yes even code comments.
- orthoxerox 6y agoThere's this little thing called Alt+Shift.
- pjmlp 6y agoIndeed, doesn't make any less painful, though.
- danaliv 6y agoThis struck me too. Writing code on an Icelandic keyboard is an awful experience.
- signal11 6y agoLooking 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#/media/File:KB_Iceland.svg https://en.wikipedia.org/wiki/Icelandic_keyboard_layout#/med...
- tirpen 6y agoμ 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.
- IceDane 6y ago> 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.
- Symbiote 6y ago
- Akronymus 6y agoQWERTZ 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_Tastaturbelegung_T1_nach_DIN_2137-01--2018-12.png 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.
- rk06 6y agoat that point, you might as well buy a QWERTY keyboard
- riffraff 6y agoI 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 https://en.wikipedia.org/wiki/QWERTY#Italian
- qalmakka 6y agoAdd 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).
- Macha 6y agoCases 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.
- waldfee 6y agoat least for windows you can change the keyboard layout to directly output the deadkeys, example for german: https://github.com/RAnders00/Deutsch-ohne-Tottasten 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/ https://zauner.nllk.net/post/0014-windows-no-dead-keys/
- ulucs 6y agoI 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.
- account42 6y ago> For this reason myself (and many other programmers) own additional ANSI-US layout keyboards. Why though when you can change layouts without changing keyboards.
- kace91 6y agoSeveral 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).
- IceDane 6y agoThe 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.
- kace91 6y ago> 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.
- R0b0t1 6y agoI've long desired a language that uses only alphanumeric characters and whitespace with minimal punctuation. Kind of a cross between Haskell and Delphi.