Your computer keyboard is prejudiced against some programming languages
June 4, 2024 3:28 AM   Subscribe

German computer user discovered that programming is much easier on an American ANSI keyboard than his native German ISO-DE keyboard... in most programming languages except HTML (which is a Markup language, but I digress). His research lead him to several realizations, as he attempts to code his open source programming project that will appeal to a world-wide audience...
posted by kschang (69 comments total) 13 users marked this as a favorite
 
It regularly fucks me up how a lot of software creators are blithely unaware of even the most widespread keyboard differences, and have no shortcut remapping facilities. They'll have shortcuts like Cmd/Ctrl-`, impossible to produce on many non-US keyboards, as the character requires the Shift or AltGr ("right Alt") keys to produce, Shift-´ here, and Ctrl-Shift-´ doesn't have the intended effect. On Macs at least you can remap any shortcuts with a top menu item centrally via System Settings, but that's not always all of them.
posted by jklaiho at 3:38 AM on June 4 [9 favorites]


Some may now shout “But what about Dvorak?!”
not shouting, just saying the quiet part out loud
posted by HearHere at 3:44 AM on June 4


I am hugging my fully-remappable Kinesis keyboards to my heart.
posted by humbug at 3:57 AM on June 4 [2 favorites]


In Poland the programmer's keyboard layout was invented for this reason. [Well, I don't know the actual history of the keyboard layout and how it came to be, but I wish there was an equivalent in Germany...]
posted by UN at 4:24 AM on June 4 [2 favorites]


I am hugging my fully-remappable Kinesis keyboards to my heart.

Every keyboard is fully remappable (in Windows) if you install AutoHotKey! You can even set up application-dependent remapping.

But yeah, even as someone who has only dabbled in programming, literally the first thing I thought upon seeing a Spanish keyboard was "how the fuck do Spanish programmers write code with this?"
posted by nanny's striped stocking at 4:29 AM on June 4 [5 favorites]


One of the little culture shocks from my move to the UK was the reality that "pound sign" meant £, not #. I mean, I knew about the pound symbol, I just hadn't clocked the implication vis a vis keyboards, and that the future relationship between my fingers and the alt key was about to get much, much closer.
posted by penguinicity at 4:33 AM on June 4 [3 favorites]


I am hugging my fully-remappable Kinesis keyboards to my heart.

All keyboards are remappable. On Windows, you can use Sharpkeys or AutoHotkey. On a Mac, Karabiner-Elements. On Linux, I think it's Gnome-Tweak-Tool on Gnome and I'm not sure what for other UIs. Setxkboptions, I think, or maybe xmodmap? Who knows. Now that we're years deep in the rewrite-everything-for-Wayland weeds I'm sure it's on somebody's list somewhere?

Remapping capslock to control is a personal favorite, it involves a bit less contorting of the wrists. Another bit of sometimes useful Secret Knowledge is that a lot of the special devices and special buttons of this world are really just keyboards in disguise, that emit the upper-numbered function keys (F13 to F24) - the back end of the Surface Book pens is a just "F20", for example - and you can remap keys to that too if it's useful.

But basically your whole keyboard is as mutable as you care to make it, it's just buttons. If you find yourself repeating the same key sequences over and over again, make yourself some macros! It'll save you a lot of joint stress and make your life better.
posted by mhoye at 4:58 AM on June 4 [8 favorites]


ALGOL was designed before ASCII was finalised, and it was full of arrows. So they had a problem: how do we represent the assignment operators that we chose as ⇐ or ←?

But the language designers weren't actually terribly worried about this. To them, this was all a formalism you wrote on chalkboards and in your papers, and some grad student would translate it on paper into machine instructions, and a secretary would type it into punched cards and verify them, and...

But by the mid-60s it was clear that programmers were going to have to Actually Touch Computers. Compilers were everywhere, LISP interpreters, FOCAL, BASIC, the works: you needed to type into terminals, and do the coding yourself. Gone were the days of programming by correspondence!

Most ALGOL-derived languages settled on ascii-art like := for ⇐. And C-derived languages decided that = should mean assignment, and == should mean a test for equality. Both of these are ugly compromises for a world that lacked printable arrow keys.
posted by rum-soaked space hobo at 5:09 AM on June 4 [18 favorites]


This then suddenly explained why so much HTML code is written IN UPPERCASE LETTERS: On a US-ANSI keyboard, you can circumvent the pain of having to use angle brackets by simply enabling caps lock and then typing everything without pressing shift at all.
I don't think this is true, because that's not how caps lock works, at least on US keyboards. Are there widely used modern keyboards where it works like a typewriter that shifts non-letter keys as well?
posted by jy4m at 5:12 AM on June 4 [24 favorites]


Oh, man, this dude's mind is going to be completely blown when someone tells him about APL
posted by phooky at 5:27 AM on June 4 [7 favorites]


language designers weren't actually terribly worried about this
so we have to live with a double slash? Tim, why? why?
posted by HearHere at 5:31 AM on June 4


I wish that more programming languages would embrace Unicode, and not just the symbols that are on a keyboard. Not to the extremes that APL takes it, but simple things that would aid readability, like × ÷ ≠ ≤ ≥ instead of * / != <= >=.

It would probably also make languages easier to parse, and avoid excessive use of parenthesis and brackets.
posted by 1970s Antihero at 5:41 AM on June 4 [4 favorites]


I use US-ANSI (the keyboard layout that don’t want none of them damn foreign accented characters). I’ve never typed HTML in all caps, and I’ve never done anything other than hand-typing it (because I have a small website and I think generated code is formatted weird). Honestly I can’t say that I’ve seen that many sites in all caps code, I don’t poke around source code as much as I used to, but it’s not anything that was ever on my radar as especially common.

Never thought about how the keyboard layout impacted the code, but it’s an interesting observation.
posted by caution live frogs at 5:41 AM on June 4


I don't think this is true, because that's not how caps lock works, at least on US keyboards.

I'm reasonably certain it's not how caps lock works anywhere. I'd reckon it's one insight that's not.
posted by deadwax at 5:46 AM on June 4 [2 favorites]


Are there widely used modern keyboards where it works like a typewriter that shifts non-letter keys as well?

He did say he built his own keyboard 🤷
posted by ChurchHatesTucker at 5:47 AM on June 4 [2 favorites]


> simple things that would aid readability, like × ÷ ≠ ≤ ≥

You can get this already for some of those symbols, by using a font with the proper ligatures.
posted by mrgoldenbrown at 5:51 AM on June 4 [6 favorites]


Are there widely used modern keyboards where it works like a typewriter that shifts non-letter keys as well?
usbtypewriter.com
posted by HearHere at 6:00 AM on June 4 [3 favorites]


I live and work in software development in Germany... and I have a spanish keyboard, because it was a present from my father. In the meantime, I know by heart where my ö, ä and ü are, even if I can't see them, but it took time.

The square brackets, braces and the octothorpe are all in different places in the spanish and german layout.

(And you'll pry my ñ from my cold, dead fingers).

Oh, and since I switch between the german layout (QWERTZ) for work and the spanish layout (QWERTY) in my free time, I constantlz misplace mz y and z. So, zou know, fun.

And by the way, CAPS LOCK works differently in the german and the spanish layout. In the spanish layout, it only applies to letters, so you can type numbers normally. In the german layout, it applies to everything, like a typewriter (and I'm old enough to have used a typewriter).

In that way, if you have CAPS LOCK on in a german keyboard, and want to type "2", you need to either deactivate CAPS LOCK or press SHIFT + 2.
posted by LaVidaEsUnCarnaval at 6:04 AM on June 4 [15 favorites]


One of the little culture shocks from my move to the UK

One of the things that shocked me and still annoys me to this day, and is the reason why I still force the US keyboard layout in Windows, is that the at symbol (@) and quotation mark (") are swapped on UK keyboards. I use " way more often than I use @, so back to US my keyboard goes.

(I also have my phone set to US English, but that's partly a comfort thing and partly so it'll understand me when I speak to it.)
posted by Mr. Bad Example at 6:18 AM on June 4 [3 favorites]


I've got an old IBM model M style terminal keyboard that has both a double row (F1-F20) of function keys across the top and the 10 function keys to the left. Plus separate enter and return keys. I had to stop using it because I couldn't adapt it's AT plug to USB but as I'm typing this it occurs to me that I should be able to wire into some micro computer like a raspberryPI and then interface it to my laptop via Bluetooth.

Anyways it was really handy for setting up macros and I wish similar keyboards were commonly available.
posted by Mitheral at 6:29 AM on June 4 [5 favorites]


I discovered yesterday that Yubikeys require QWERTY (it's not entirely clear to me if it's QWERTY or US keyboard layout). Somehow Yubico thinks this isn't something they need to address properly. What exactly I'm going to do about this, I don't know. I'm reluctant to install Karabiner on a work laptop and the *nix solutions you'd do on Linux to give the Yubikey its own layout won't work on OS X.
posted by hoyland at 6:37 AM on June 4 [3 favorites]


Yeah, the thing that I always wonder if it's just because I'm looking from an ANSI/US perspective, but given the popularity of mechanical keyboards and custom keycaps, I'm always surprised by the paucity of ISO caps out there. Like, even my preferred Akkos with triple and quadruple variants of some keys might have an ISO Enter, but god forbid they have an £ key or any of the common ligature caps. And if you're used to azerty or qwertz or any of the other ones that moved keys between rows, it's got to be a royal pain in the ass building your own keyboards. Keychron seems to maybe give a damn, but I don't see a lot of other alternatives out there.
posted by Kyol at 6:38 AM on June 4


I have recently learned that if you really want to get a francophone Canadian public servant to really start ranting about some shit, ask them how to type a ù on their surface tablet keyboard.
posted by jacquilynne at 6:43 AM on June 4 [7 favorites]


It regularly fucks me up how a lot of software creators [...] have no shortcut remapping facilities.

I use keyboard shortcuts for as much as possible for RSI reasons, and I try to keep them as short as possible, which often results in my system-level shortcuts conflicting with in-app shortcuts, which makes the in-app ones unusable. Which sucks. If there isn't an accessibility standard that says there should be keyboard shortcut hooks for basically anything that can be accomplished with a click, and that all shortcuts should be customizable -- there should be. And if there aren't UI libraries making that easy and automatic for developers, there should be.


On the multilingual side, some apps seem to map shortcuts based on physical keys pressed, and others based on symbols typed. The second approach is really, really annoying when you're frequently switching between languages: some languages don't have the symbol the shortcut needs so you have to switch keyboards, or they'll have it but it'll be in a different place so your muscle memory means you constantly get it wrong. I shouldn't have to constantly keep track of what language I'm set to in order to use a keyboard shortcut. Shortcuts should be based on the physical keys being pressed, regardless of language. (And, again, they should be customizable so you can set them in a way that makes sense if the default doesn't.)
posted by trig at 6:59 AM on June 4 [2 favorites]


I'm not surprised at all that keyboard design is all over the place and that specific keyboard combinations that are idiomatic to a specific style of keyboard were baked into standards that then needed to be implemented across a wide variety of keyboard layouts. Beyond the obvious challenges of generalizing what is essentially a language transcription device to fit every language, there's also the issue that programmers and engineers are legendarily terrible at UI/UX, full stop.
posted by grumpybear69 at 7:09 AM on June 4 [2 favorites]


Someone on Mastodon recently pointed out that when the Mac was first introduced, the most common editing functions were assigned ⌘Z/X/C/V because those letters were conveniently right next to the command key…on a QWERTY keyboard. AZERTY, QWERTZ, and other keyboards break this, and in fact ⌘Z on a German keyboard is a bit of an uncomfortable stretch.

Someone else on Mastodon pointed out that Germans deal with this by never making mistakes.
posted by adamrice at 7:31 AM on June 4 [18 favorites]


But why would HTML use such an inconvenient character for code[?]

Tim Berners-Lee invented HTML while he was in the Swiss laboratory, and thus was most likely using an ISO-type keyboard, which features this handy button next to the shift key.
And thus, the most dubious leap in the history of histories of computer languages was made.
posted by Tell Me No Lies at 7:49 AM on June 4 [2 favorites]


One of the nice features of the Julia programming language is that its interpreter and many of its text editors will allow you to enter some LaTeX-style sequences (like \alpha) and "autocorrect" them to their unicode equivalents (α). This makes it much easier use a broad range of symbols, as long as a backslash is easy to type on your keyboard.
posted by biogeo at 8:08 AM on June 4 [2 favorites]


Your keyboard was designed for COBOL and FORTRAN. Everything you need for those languages is right there.
posted by scruss at 8:14 AM on June 4 [5 favorites]


My memory of learning HTML back in the 90s is that using all-caps for your tags was a stylistic convention explicitly recommended by the book I used to make your markup more readable. I think it was later that ideas changed and it was recommended not to all-caps your tags in the interest of readability. I don't think caps-lock on US keyboards had anything to do with it, and I suspect the author here is just making an assumption from perhaps a slightly too-narrow focus on the physical keyboard in developing his thesis. Still a very interesting read with good points, though.
posted by biogeo at 8:23 AM on June 4 [1 favorite]


the at symbol (@) and quotation mark (") are swapped on UK keyboards.

I owned a Commodore 64 (well, I still own one) which shipped with this quirk, and it was decades until I realized that it was a side effect of the keyboard being some kind of UK layout compromise. The fact that £ had its own key all to itself should have been a clue to young me.

Writing code on that thing was a bit of a pain in the ass, but it was doable. It was probably more the hideous arrow key situation that hampered the effort: you only had CUR-RIGHT and CUR-DN. To go left or up, you had to shift them.

In general, though, I think programmers and most people in tech don't think holistically about the problem they're trying to solve. That's how you wind up with sites where one page accepts my quotation character-containing name but the next page doesn't, how you get billing systems that require international users to enter a very specific US address for their order (hi, Best Buy!), games with control schemes that can't be typed by entire countries, and... modern languages that are hard to write code for with millions of keyboards.

There's a commonality here: a lot of people write software that solves problems in domains they're familiar with, and they aren't familiar with the actual domain the software's going to wind up being used in.
posted by majick at 8:29 AM on June 4 [2 favorites]


I think the author is bringing up an interesting topic, but this particular article is weighted down a lot of dogshit and it's kind of bursting the bag. In particular,
But why would HTML use such an inconvenient character for code, while all the other languages use easy to reach characters (for US keyboard users)? Well, while most programming languages have been invented either by US-Americans, in the USA, or at least with a strong US bias, HTML has been invented elsewhere. At CERN, to be precise. Tim Berners-Lee invented HTML while he was in the Swiss laboratory, and thus was most likely using an ISO-type keyboard, which features this handy button next to the shift key.
HTML uses angle brackets because it's loosely based on SGML, which uses angle brackets. And SGML was developed in the 70s. By US researchers. Using, as the author puts it, US-ANSI keyboards. This isn't some inside-baseball computer history obscurity. It's on the wikipedia page for HTML. In the fucking infobox.

Sorry, but I kind of have to jump on this because this is how bullshit just-so stories get started and propagated: lazy prognosticators who can't be bothered to do ten seconds of research.

also, they link the 8-bit guy? seriously?
posted by phooky at 8:34 AM on June 4 [22 favorites]


I'm always surprised by the paucity of ISO caps out there. Like, even my preferred Akkos with triple and quadruple variants of some keys might have an ISO Enter, but god forbid they have an £ key or any of the common ligature caps.

There are keyboards with tiny little.displays built into every key but that's going to be really expensive. Seems like it would be pretty simple to roll your own custom key caps with a set of blanks, a small cnc machine and something to fill the resulting grooves (eg a crayon like old school DnD dice).
posted by Mitheral at 8:47 AM on June 4


Or a Sharpie every month.

And by the way, CAPS LOCK works differently in the german and the spanish layout

I groaned out loud. Raising an imaginary glass of something delicious and carefully putting it down where it can’t spill into anybody’s keyboard.
posted by clew at 9:00 AM on June 4 [3 favorites]


HTML uses angle brackets because it's loosely based on SGML, which uses angle brackets.

All true, but would Berners-Lee have adopted SGML syntax if it used square brackets?
posted by pwnguin at 9:03 AM on June 4 [1 favorite]


Or a Sharpie every month.

Yeah, I have a short stack of requirements for my current keyboard (home, pgup, pgdn in specifc slightly unusual rows, 1u alt/fn/ctrl, and so forth), but I would probably throw a lot of them out the window for a set of keycaps that had forward-facing alternates like play, pause, forward, rewind, mute, and a set of in-keyboard numeric keypads that I could just fn-mode my way into. I have a set somewhere that I very carefully sharpied 0-9 onto the front of, but in practice it was just easier to get a standalone numeric keypad.
posted by Kyol at 9:08 AM on June 4 [1 favorite]


Probably, because despite the focus of "keyboard athletes" a thought out syntax already in use is rare.
posted by clew at 9:08 AM on June 4


The quotation-marks-on-2 thing is actually a facet of what used to be called "bit-paired keyboards": the shift and control keys would mask on and off specific bits in combination, and you can see the old C64 layout in this image of the ASCII table, right to the left of each digit.

Personally, I will never give up quotation marks next to enter, nor Ctrl next to A, because I learned to touch-type on a Leading Edge Model D keyboard. So yeah, I've spent the past 20 years only using US keyboard layouts in the UK, although I adopted the spelling when they gave me the passport.
posted by rum-soaked space hobo at 9:22 AM on June 4 [4 favorites]


We have computers set up in Spanish where I work and there is a constant struggle between people setting them for the Mexican keyboard vs. the Latin American keyboard.

I sprung for a new keyboard for the main machine (which previously had an American keyboard on it) and went out of my way to secure a Mexican keyboard, but this has not stopped people from reconfiguring the system on a regular basis.
posted by Tell Me No Lies at 10:02 AM on June 4


Frankly, given the trend in modern equipment design I'm just happy to see a keyboard at all. And no, whatever idiotic overlay phones obscure half the screen with every time I'm required to enter text does not deserve to be called a keyboard of any sort, especially not a "soft" keyboard, because the action on those things is the hardest.
posted by flabdablet at 10:54 AM on June 4 [6 favorites]



I've got an old IBM model M style terminal keyboard ..I had to stop using it because I couldn't adapt it's AT plug to USB

Please excuse me if you know this stuff already but I use my old school kinesis AT plug keyboard with an AT->PS2 adapter plugged into an active PS/2 -> USB adapter. The AT adapter is a simple pass thru because AT and PS/2 are identical except for form factor. The USB adapter needs to be an active component -- the little green MS ones are just passthrus.
posted by Sauce Trough at 12:48 PM on June 4 [3 favorites]


HTML uses angle brackets because it's loosely based on SGML, which uses angle brackets.

> All true, but would Berners-Lee have adopted SGML syntax if it used square brackets?


They're both languages that mark up text, so ideally they should be able to handle real-life text that isn't formatted in some special way to support the marking up. Square brackets aren't common in regular text, but they're still more common than angle brackets. If square brackets were used instead of angle brackets in HTML, then anybody writing editorial notes like "[sic]" or "[...]" or any of the other random things people use square brackets for would have to escape them, the way we currently (and annoyingly) have to write &lt; and &gt; to display < and > in HTML. (Unless, of course, parsers were much more sophisticated, but there would still always be edge cases, and given the processing power back then this probably was the best choice.)

(They should have gone with {curly braces}.)
posted by trig at 12:51 PM on June 4


Frequency analized a lot of my code and brackets are way down the list, at positions 14-18 and used 10% as often as dash and dot. Meanwhile > is in the top ten. Of course, I am a Haskell programmer, so..
posted by joeyh at 1:52 PM on June 4 [1 favorite]


get a francophone Canadian public servant to really start ranting

The Canadian French (sometimes Canadian Bilingual) keyboard is a horror for everyone. Once had a work MacBook that had it, and it had all the wrong keys in all the wrong places. If you ever see a laptop for cheap in Canada, it likely has one of these dismal keyboards.

would Berners-Lee have adopted SGML syntax if it used square brackets?

Fun fact: SGML can use square brackets to denote entities. Really, almost any pair of characters can be defined to act as the < and > characters. Even > and <, so you'd end up with >tag<this>/tag<. Bleeahh.
posted by scruss at 3:41 PM on June 4 [5 favorites]


Heh just saw this about "_" being a pain (not sure why - to me it's easy, but the point/discussion still stands as a perfect pairing to OP):

Underscores are stupid, get a Japanese keyboard
(via: hackernews)
posted by symbioid at 4:28 PM on June 4 [1 favorite]


"On Linux, I think it's Gnome-Tweak-Tool on Gnome and I'm not sure what for other UIs. Setxkboptions, I think, or maybe xmodmap? Who knows. Now that we're years deep in the rewrite-everything-for-Wayland weeds I'm sure it's on somebody's list somewhere?"

Yeah - I'm in WSL with Vim lately and tried to map caps, but it was awful. Dont' take anything I say here as 100% truth as it's from memory from 2 nights ago from a long multi-hour session trying to figure out how to do this...

WSL is using wayland (supposedly it can also use X, but I didn't want to go down that rabbit hole of going to x just to remap with xmodmap). You have to use Gnome to do it. Which was like WHY THE FUCK DO I NEED TO INSTALL A GUI LIBRARY JUST TO REMAP A FUCKING KEY. Because the Wayland Client has to send it to the server (since the key handling is done on the client. There's some other weird shit about console escape codes, too IIRC.)
Anyways someone said you can remap in windows (and I used the remap utility in powertoys, but that's global for all systems).

It looks like AutoHotKey (which I've used ages ago for scripting) is probably the best bet. But why isn't there just a simple console io way to remap without having to go through X/Wayland? It's so bloody ... weird. But I know - all tech is shitty that way.
posted by symbioid at 4:38 PM on June 4


Indeed, some templating languages that build on top of HTML use curly brackets instead of angle brackets. For example, Twig utilizes ({{% and %}}) to delimit statements, because it has been developed in the United States.
This is also incorrect; Fabien Potencier, the creator of Twig (and at the time the lead dev on Symfony), is French (iirc he lives in Paris). Twig based its syntax heavily on Jinja, which is the Django template engine—but that one was created by Armin Ronacher, out of Austria. No US keyboards anywhere in sight!
posted by adrienneleigh at 8:01 PM on June 4 [3 favorites]


This is exactly the kind of problem Whitespace solves, even if it was designed by a couple of Brits most likely using ASCII keyboards.
posted by morspin at 8:11 PM on June 4 [2 favorites]


@scruss there, talking about hacking the SGML declaration... do I know you?
posted by morspin at 8:12 PM on June 4 [2 favorites]


use my old school kinesis AT plug keyboard with an AT->PS2 adapter plugged into an active PS/2 -> USB adapter.

I besides the monster with all the extra keys I also have an early 80s plain model m and 15 years ago I couldn't get a USB adapter to work with it. I really should give it a try again, USB is so much more robust than it used to be.

The problem with the monster is it's actually a terminal keyboard. It has a dip to switch between 3270 and PC but I haven't ever got it to work on anything without an actual AT port. Not that I tried dozens of ps2 connectors or anything but of the half a dozen machines I had between AT and only USB none of them worked. I always figured there was more going on than simple key presses.
posted by Mitheral at 8:34 PM on June 4 [1 favorite]


the at symbol (@) and quotation mark (") are swapped on UK keyboards.

This was a big part of the gigantic frustration that was this contract gig I only stayed with for a couple weeks. I had to go in to a physical office, where they wanted me to use their peripherals (cheap keyboard, awful cheap wired mouse, external monitor) on my MacBook Pro, but with a Windows virtual machine for security. But they'd never had U.S.–based contractors before, so the Windows virtual machine had UK keyboard settings, and setting it to U.S. keyboard settings only worked intermittently. This made it such slow going for me, when normally I'm a very fast typist (I've won typing challenges). So then the person training me kept impatiently taking over the keyboard, rather than telling me where to go and letting me do it, and when she did so, she kept accidentally leaning on the up button for the sit-stand desk, so then we had to readjust the height of the desk before we could proceed... It was just such a multifaceted nightmare, and that was just the first day! It didn't get much better from there.
posted by limeonaire at 9:08 PM on June 4 [1 favorite]


Jinja, which is the Django template engine

Django's templating predates Jinja. Many people use Jinja instead, because it was designed as a drop-in replacement with a few better features like sandboxing. The Jinja homepage even directly cites Django as inspiration:
Jinja2 is one of the most used template engines for Python. It is inspired by Django's templating system but extends it with an expressive language that gives template authors a more powerful set of tools
Who built Django? According to one of the authors:
Django started when Adrian Holovaty and I were working together for a year at the Lawrence Journal-World newspaper back in 2003-2004. [...] My internship only lasted a year, and a month before we left we hired Jacob Kaplan-Moss as my replacement. Jacob and Adrian continued to develop Django
I wouldn't be surprised if two or even all three have mefi accounts to tell us what inspired them in turn (probably a hatred of PHP?), but as best I can tell, it came from two Americans and a British intern.
posted by pwnguin at 9:23 PM on June 4 [1 favorite]


I wish that more programming languages would embrace Unicode, and not just the symbols that are on a keyboard.

The track record of symbols that don't exist on keyboards (but exist in character sets) is not good.

ASCII, notably, contains a whole range of "non-printing" characters, some of which are very well-thought-out and would be incredibly useful for things like text markup and structured data: the "field separator" and "record separator" characters, for instance, eliminate many of the problems inherent in formats like CSV (which uses printable characters for delimiters, creating an escaping problem if one of those delimiting characters actually occurs in a value).

It's pretty trivial to produce a better-than-CSV structured text file using the proper non-printing ASCII separator characters, but almost nobody does it. The non-printing characters, because they don't appear on physical keyboards, might as well just not exist.

And such is the fate of most non-keyboard Unicode characters as well, except for those where there's an easy way to "type" them via auto replacement actions. E.g.: lots of software will automatically replace three periods with an ellipsis, or replace hyphens with en- and em-dashes, which means they get some use.

But there's no easy way to determine when a user wants to enter a field or record separator, and no easy way to type one, so they are pretty much dead to modern markup languages. And instead we get hacky character-escape bullshit.

I blame DOS and Windows for this, in large part, because they make it a royal pain in the ass to type characters that aren't literally printed on the keyboard's keys. (The AltGr-plus-some-mystery-codepoint-number thing is atrocious, and whoever came up with it deserves arthritis.) Mac OS has always been a bit nicer in this regard, with its Option-key combinations: they're still not obvious, but at least they only require a modifier-plus-key combination to type. Linux, naturally, is inconsistent and has a dozen solutions for the same problem, most of them inconvenient to enable.

So, yeah: I don't blame language designers from shying away from using characters that aren't plainly printed on a standard US keyboard, because the track record of anything that isn't included there just isn't great.

Personally, I wish the standard PC keyboard had been standardized to have at least one more modifier key (which could be Alt/AltGr if it weren't used for the stupid codepoint hack), and then there was a standard set of tertiary symbols for each key, above the normal and shifted characters. We'd have a lot more room for symbols that way, and less escaping of normal written characters would be needed for stuff like data storage and transmission.
posted by Kadin2048 at 12:38 AM on June 5 [5 favorites]


If you get a keyboard that is QMK compatible, you can arrange your keys how you like--and have multple layers of keys as well.
posted by mekanic at 12:51 AM on June 5 [1 favorite]


ZMK is another option, with the right keyboard.
posted by esoteric things at 1:17 AM on June 5


Is this a safe space to talk about trigraphs??!
posted by autopilot at 1:34 AM on June 5 [1 favorite]


why isn't there just a simple console io way to remap without having to go through X/Wayland? It's so bloody ... weird.

If your problem were my problem, the first option I'd investigate would be keyd.
posted by flabdablet at 2:31 AM on June 5 [1 favorite]


Please excuse me if you know this stuff already but I use my old school kinesis AT plug keyboard with an AT->PS2 adapter plugged into an active PS/2 -> USB adapter.

At the time I built the new computer that didn't have PS2 ports, active PS/2 -> USB adapters were rare if they existed. So I bought a Unicomp. I now have 3. One for home, One for the office, and a spare (picked up when I had to send one back for service).
posted by mikelieman at 4:34 AM on June 5 [1 favorite]


@scruss there, talking about hacking the SGML declaration... do I know you?

Don't think so. I was hacking away SGML stuff circa 2000 at Collins Dictionaries in Scotland, working on EU research projects. I may have been permanently harmed by working with DSSSL. XML + Unicode was a breath of fresh air compared to working with bilingual data in ISO 8859 character sets. You could have Greek and Italian *in the same document*!

Compose keys are nice. You can even make Windows have one with WinCompose. But MacOS uses its own thing, far inferior to the baroque glory of what you can do with Compose. Mac's way of doing it may have been standard for decades, but it's a Mac standard, so not the same as Compose.
posted by scruss at 8:40 AM on June 5 [1 favorite]


Almost all of the european devs I know end up just setting their keyboard to US when writing code, and then setting it back to their native type when writing text that requires it (which is a small amount of their use, since they're mostly devs). It was even in the orientation guide for one company I worked for over there. You had this situation where even most of the comments were in english, because english is what programming is done in(tm),
There is a similar trope around this in japan, where most older computer games were full of little bits of english, because all programming happened in english, and computers were better at it, and so devs just did that, and so gamers got used to that.

Anyhow, one of the issues around this is that the people who are designing computer languages are the ones who are already in this space - plenty of modern development environments were designed in a non-english speaking environment (Thee common examples: Python's creator is Dutch, Ruby's creator is Japanese, c++'s creator is Danish), but yet they're fundamentally all us-ascii centric systems, because that's how things are done in that world(tm). I used to work with some Czech people who were designing a new language, and indeed, it committed all of these sins. It honestly just didn't occur to any of us that it was a problem, at the time. Which, in retrospect, seems odd, but I wonder if part of it is that programming languages have always existed in a global culture, and it made some sense for a single lingua franca to be chosen, and us-english was it.
posted by jaymzjulian at 11:21 AM on June 5 [3 favorites]


(as an aside: one of the interesting exceptions to this is in ruby, nothing is plurals - File.exist? rather than File.exists?. The reason for this, is because in japanese, plurals aren't a thing, and so "File exist?" makes more grammatical sense there, and so too did that leak into ruby!)
posted by jaymzjulian at 11:23 AM on June 5 [3 favorites]


oh yeah there is an old “joke” among programmers in Japan
Q: What language should I study first if I’m just starting out as a programmer?
A: English
posted by DoctorFedora at 3:17 PM on June 5 [4 favorites]


oh yeah there is an old “joke” among programmers in Japan
Q: What language should I study first if I’m just starting out as a programmer?
A: English


Here in Mexico a 4 year computer science degree includes 4 years of English.
posted by Tell Me No Lies at 6:29 AM on June 6 [4 favorites]


flabdablet - thanks for the link, alas it looks like systemd is causing issues with Tmux (I assume it's a dumb WSL issue, dealing with sessions and pipes, and documentation is sparse because it's a confluence of like 3 separate systems), but once I went back to regular init tmux behaved properly).

I actually went to systemd to try some options (I think I starred this on github in fact), but got caught on the tmux issue (forgetting the keyboard issue why I installed systemd in the first place LOL). Based on the page you linked it uses systemctl which I believe is a systemd feature? Looks like (in WSL at least) I'm kinda stuck between a TMUX and a Keyswap. Oh well! In case anyone else seems to have issues or is thinking about it.
-----------
I do like the idea of a third possible symbol on keys that can do at least basic common accents.
Windows Powertoys has an easy option without having to remember the codes, but it always seems to misfire when I'm not intending to activate it, so I had to shut it off (not that I type languages that use it much, but it's still nice to have so you don't look like a total git when needing to type a specialized letter).

Frankly - there should be a common markup way to add accents at the very least - maybe something like for enye or whatever it's called. But I can see how hard it would be to add that now, I mean &Oacute is so much easier to type, amirite (or remembering 3 digit codes). But nobody would implement it since html in text boxes seem verboten on most social media sits in the first place.
posted by symbioid at 1:14 PM on June 6


there should be a common markup way to add accents at the very least

Compose + ' + o → ó

Srsly, the Compose key is the bomb.
posted by scruss at 3:45 PM on June 6 [1 favorite]


Based on the page you linked it uses systemctl which I believe is a systemd feature?

sudo systemctl enable keyd just tells the root instance of systemd to add keyd to the list of services it launches automatically after init; sudo systemctl start keyd tells it to launch keyd right now.

Keyd doesn't list systemd as a prerequisite, so if you're using a non-systemd init, I'd expect its customary way to install and launch persistent daemons to work for keyd too.
posted by flabdablet at 4:16 AM on June 7 [2 favorites]


Hmm I'll check it out.
For now it seems Powertoys works, *but* it needs to run in Admin mode, which is... Not something one wants to do.

I'll shut up in this thread, but thanks for the tip.

Also - for some reason I thought Compose was a Mac thing, but it's ... Linux? Well I'll be.
posted by symbioid at 9:18 AM on June 7 [2 favorites]


Just a quick update (sorry to threadsit/jack the thread but since it's already here):
FYI for those who are having issues with remapping in WSL2.
The default WSL2 Ubuntu Kernel does NOT have modules (uinput which is required by keyd), it's all statically(?) compiled by MS.
If you want modules, you'll have to compile a custom kernel for WSL2.

Mods: please delete if necessary, just figured it would be a nice public service for people to know so they don't go down a rabbit hole when it comes to keyd->WSL2. It's possible but needs a custom kernel compile.
posted by symbioid at 10:37 AM on June 7 [1 favorite]


Mitheral, regarding your 3270 keyboard (is it one of these beauties?), I'd be curious if, while it probably has the larger "AT-style" DIN connector (instead of the smaller PS/2 style), the keyboard is meant to be connected to an XT rather than AT style PC. XTs had a dedicated chip (8255? i think?) on the motherboard for handling DIP switch configurations and keyboard input, where on the AT, that chip is gone and keyboard input is handled by a microcontroller instead. XT keyboard communications were one-way (send only) but AT communications were two-way, for instance using LEDs to show numlock/capslock status, etc. Scan codes were different between the two as well, I think.

All of which is to say, while it may share a "AT-style" DIN connector, it may be expecting XT-style communications, which is why you haven't been able to get it to work. Back in the day, a lot of those keyboards had an XT/AT switch to allow them to be used on either; necessary because the protocols were so different. In looking for an adapter, you may need to dig deeper to find something that supports an XT-style keyboard...?
posted by xedrik at 12:19 PM on June 7 [1 favorite]


« Older Classically trained Indigenous chef says native...   |   Have a horny day! Newer »


This thread has been archived and is closed to new comments