I recall that I was once writing some TeX code, and I encountered something like this
\count\foo
\foo=2\otherMacro
[\the\foo]
If \otherMacro was defined as something like \def\otherMacro{9 cats is too many} then \foo in the above line would actually get set to 29 instead of 2, because the 9 from the cats macro would be absorbed.
A more insidious case is something like this:
\newcount\foo
\def\setfoo{\foo=2}
\def\otherMacro{9 cats is too many}
\setfoo\otherMacro
[\the\foo]
This code also goes awry and absorbs the 9, setting \foo to 29. In this case it's harder to know where the appropriate place for the fix is. And it's hard to see the error when looking at \setfoo\otherMacro without also going back to the macro definitions, because in real-world cases the macro definitions will probably be very far away from the invocations.
I remember that at the time I ran into this issue I sat down and developed a comprehensive understanding of all of the cases where this would happen, and I adopted a set of defensive coding standards to prevent it, which involved liberal use of % and spacing. However, I didn't take any notes, and I'm not confident that I can remember all of the details and nuances. For example, I can't recall whether or not this ever happened when dealing with \dimen or other types of registers, and I can't recall exactly what my rules were for the defensive use of % and spacing.
I'm about to sit down to experiment with this TeX-gotcha once again, but I figured that it couldn't hurt to also post to SO for community advice. I know that SO doesn't usually like discussion threads, so I'll put it like this instead: If anybody has a comprehensive understanding of these issues, then a single-post brain dump on the matter would make for a solid SO-appropriate response.
Note also that I'm using Plain TeX, and not LaTeX.
[UPDATE]:
After considering suggested solutions from David Carlisle, and considering the caveats which he described, I'm amending this curiosity to this post:
\def\otherMacro{9 cats is too many}
\newcount\foo
\def\bar#1{[\the\foo][#1]}
\def\setfooSpace{\foo=2 }
\def\setfooRelax{\foo=2\relax}
\afterassignment\bar\setfooSpace\otherMacro
\afterassignment\bar\setfooRelax\otherMacro
The second-to-last line results in the text
[2][9 cats is too many]
while the last line itself results in
[2][]9 cats is too many
Both the \relax and the 2<space>solutions work to prevent the absorption of the 9 into the 2, but the solution with the space appears to be superior in that it makes a macro like \setfoo feel more atomic.