I often find typos cognitively fascinating.
Some typos are just last-moment motor errors: "aimed for this key and hit the one next to it". Those are easy to understand. But others reveal much more interesting things about the mental process of driving your fingers on the keyboard, or even composing words.
I once aimed to type 'programs', and unexpectedly 'rpgroasm' came out. All the left-hand letters appear in the correct order, and so do all the right-hand letters, but they're interleaved in a spectacularly wrong way. That suggested that one part of my brain had sent an independent set of instructions to a subthing controlling each hand, and everything worked fine except the synchronisation between the two subthings.
There's another class of typo which I think of as 'brain got ahead of fingers': you're typing one word, but already thinking about a word that will come after it, and there's a crossover and you end up mixing up the two. Like 'bit bisect' in place of 'git bisect' β you're already planning the b, and it comes out of your fingers prematurely.
(Appropriately, as I typed _that_ sentence, 'in place' came out as 'pl inace', wow.)
Even the 'boring' motor errors have something cognitively interesting about them, just on the reading rather than writing side. We see 'adjacent letter on the keyboard' typos a lot, so our brains get good at correcting them. Sometimes _over_-correcting, so that you imagine a typo where none existed. When a sentence is a bit unexpected in context, I've been known to consider the possibility of a typo before figuring out how the sentence as originally spelled makes sense.
The best ones of those are when I hadn't even _realised_ the two words were a typo apart. I misread 'auction' as 'suction' once and it was a total surprise!
I wonder if there's any serious scholarly study of this kind of thing.
sometimes I will typo words into different homophones, happens more often for less common words. I would definitely clarify this as a typo, but it's a really odd example, where my brain knows the word, knows how it's spelled, but will hand it off to some other part of my brain, which transcribes it's thoughts and will somehow will end up wrong
I dunno its a weird one, it doesn't happen too often
they probably could. Of course nowadays there are at least hundreds of niche layouts (in part building on increasingly sophisticated computer analysis of growing corpuses of text - see eg https://layouts.wiki/guides/start/intro/ which has loads of examples).
I guess this means learning an alternative keyboard layout is actually a privacy issue - typo-fingerprints being another way to identify you just from your writing?

yes, I've always thought formal touch-typing training is better suited to people typing English text than to programming.
I was never formally trained at all. I just typed, mostly on my own time, since an early age, and my motor cortex gradually optimised my actions without me really paying attention, until I could hit >100wpm on a good day. But it's noticeable that the style I evolved is not the usual touch-typing style with a fixed posture on the home keys. It's far more flexible β I can adapt to having a few fingers out of action (e.g. holding a pen or a snack) almost without having to think about it, just using whatever fingers I have for whatever they need to do. And I never use Caps Lock, because I find it easier to hold down Shift with one finger and just use the other 9 however seems sensible. And often I find my left hand covers _more_ than half of the letter keys, while my right hand is free to go for punctuation symbols and the arrow keys (or all the way over to the mouse or trackball), since β as you say β programming is much more heavily weighted towards both weird characters and editing your existing code.
Another noticeable thing about my posture is that my wrists don't bend outwards in the way they'd have to to settle my fingers on the home keys. My hands land on the keyboard at an angle, and just deal with it. Perhaps this is good for getting less RSI!
@pjacock yes, I too use my hands much more flexibly in terms of what finger I use for a given key, sometimes letting either hand cross over to "the other side" if that works best.
It's possible this flexibility increases the chance of 'mis-strikes' as my sense of my hand position drifts over time, but if ever lose a finger I ought to still be okay for typing.
I do use both shift keys, but still often use the same side shift as the other key I'm pressing. That's one habit I've actively tried to stop because I'm sure the way I use the side of my little finger to hold shift can't be good for it.
@GerardThornley @pjacock
I was taught touch typing - twice even, first on an electric typewriter, then on a terminal. I use a Wacom digitizer rather than a mouse, and I often catch myself typing with the pen between my fingers. Though I never paid attention to whether different fingers take over or I've found a way to hold it that allows me to use all ten fingers.
The wrist bending thing I never understood. Fingers have different lengths, with the pinky being the shortest, so to hit the keys optimally, the hands need to be at an inwards angle. For that reason I've never liked Microsoft Natural Keyboards, I need to push my elbows way out to get my hands at the optimal angle.
oh yes I frequently find I have one hand ahead of the other. I call this 'Quake Finger' as I attribute it to playing a lot of FPS games which trained the twitch reaction in my trigger hand to be 'leading' my thought patterns more than the other hand.
I have to deliberately type slower to avoid it π€ͺ
@Slash909uk oh, wow! I hadn't even begun to consider the influence of non-typing keyboard activities like gaming.
I don't _think_ I have any influences like that β I don't normally play twitchy games on a PC keyboard. (Console controllers more usually.)
But that does remind me that _something_ has happened to my keyboard-related motor control since I was a child. I used to play games on a ZX Spectrum, where if you didn't have a joystick the usual keyboard layout was QAOP for directions and M for fire. Nowadays, if I try to use anything like that layout, I just can't β having the fire control on the same hand as two of the direction keys doesn't work for me, because I can't hammer my thumb for continuous fire and also use two fingers of the same hand for 'steer carefully through these rocks' without neural crossover causing mistakes in both of those actions.
Instead I have to allocate a whole hand to the firing control now, and use a reverse-T of arrow keys on the other hand for movement (whether WASD or the actual arrows). That's objectively less good, it seems to me, because three fingers between four arrow keys isn't enough, and sometimes I die because I can't move my finger between β and β quickly enough. But my motor cortex won't cope with anything else any more!
@dec23k I wrote one of those at university, as part of a prank in which we made a chatbot basically implementing the good old ELIZA algorithm, and sent it on to a bulletin board to wreak havoc. We made it delay a bit before replying, and insert random typos, in the hope that at least _some_ people would be fooled for long enough to be amusing.
Even so, we weren't very subtle about it β we called the account 'eliza'. But that meant it had a female name, in an online chat room, in the mid 1990s, and someone was fooled enough to spend 15 minutes trying to chat it up, in spite of everyone else having clearly figured it out, and _trying_ to tell him!
your second example is the same thing as what happens when your brain is faster than your mouth: swapping letters, smooshing words together ("great" + "cool" = "grool"), skipping words (more noticeable in written form than when spoken).
My hypothesis is that the typos you describe are more likely when we are tired, excited, or distracted; basically when our brain cannot allocate enough power to the task.
@fritzoids in speech, one of the really interesting ones to me is the spoonerism. It's easy to see how the _first_ half happens: as you say, you're speaking word #1 while already thinking about word #2 and there's a crossover, so you turn (for example) "test words" into "west ...". But this idea doesn't explain the second half, where the part that went missing from word #1 is hauled back out of some kind of buffer and belatedly emitted. It would seem more natural to me if you _stop_ after saying the mangled first word, suddenly realising you've gone wrong somewhere.
Last summer, at home with my windows open, I overheard an angry mother in the street outside yelling at her child "Go brush your hair and wash your ..." and then she stopped in confusion, because she'd meant to say "wash your hair and brush your teeth", and realised "wash your teeth" didn't make any sense. That's what I _expect_. Continuing on to say the nonsensical second half without even realising, that's more interesting!
@clanger9 for some reason that one happens to me most often in my own name! I'm constantly signing off emails as SImon.
But I suppose that since my best known project also changes the case of the second letter of its name, that's only appropriate!
@maghoff my very favourite one of those is this sequence of shell operations, which I _still_ can't stop doing even though it's such a familiar mistake:
git stash
[do some other thing in this git work tree]
^Y
When I want to save a half-written command line in order to run another command first (e.g. I've suddenly realised I need to cd into the right directory before running the complicated thing I was half way through writing), I'll press ^A^K in bash to cut the whole line into bash's paste buffer; then do my other command; then press ^Y to paste it back on to the next command line and carry on typing.
So ^A^K [...] ^Y is a finger habit for "put this half-done thing aside, and resume it later after doing something else first".
So is "git stash" [...] "git stash pop", in a completely different context.
And I often slip between the two, pressing ^Y when I should have typed "git stash pop", because I made a cognitive error at a higher level than the usual kind of typo, and forget _which_ kind of "resume the half-done thing" I was meant to be doing!
Curiously, never the other way around. ^A^K [...] git stash pop is unheard of. Even when I'm half asleep I know _that's_ too silly.
: in French, we have a lot of "homonyms": completely different words, different meaning, different spelling but same pronunciation.
When proofreading myself, I often found that I replaced a word by its homonym, even if the spelling is more complex.
Which means that when I touchtype, I do it based on internal dictation to myself and that I automatically "hear" the word before transcribing them.
Which is weird as Iβm a very visual person and I "see" words in my heads when writing
Sorry for the nitpicking: those are homophones. Homonyms have identical spellings.
I'm sure there is research, though unfortunately I cannot point you too anything.
When I was in high school, a language teacher gave me a book about human language formation. I was fascinated by a chapter that explained how mistakes can be used to uncover how a system works. The book listed various types of errors that happen with sentence formation, and how they co-occur, and what that might mean about how and in which order the brain builds sentences. There's other imaginable types of errors and combinations that don't happen. There was also something about how small children who don't speak "correctly" yet form sentences, and people who for example have had a stroke.
The part where you find that each hand gets its separate set of letters to type, and that they normally would then be synchronized, but sometimes that doesn't work out, is exactly the same thing.
Using errors to learn about what's going on in the black box is a method of hacking and reverse engineering, but I didn't know that in high school.

RE: https://hachyderm.io/@simontatham/117529635474475381
@jerrej ah, like my own example spoonerism elsewhere in the thread!
(That was unintended, but once I noticed it, I decided it should stay.)