This is my first post here, so I hope I do it well (I am French).
I don't understand the spacing after \mathinner.
Here is a MWE:
\documentclass[a4paper]{article}
\begin{document}
$\mathinner{}!$
$\mathinner{}{!}$
\end{document}
The spacing before ! is not the same.
I thought ! was of type \mathord so typing {!} shouldn't change the spacing but it does: there is a \thinmuskip in the second line (which is correct between \mathinner and \mathord) but not in the first line and I don't get it.
Why is ! not of type \mathord in the first line? And which type is it?

\mathinnerreally seems to do is distort the spacing, should we consider it a historical mistake in TeX, or are there any real benefits? – Gaussler Aug 24 '21 at 08:46\showthe\numexpr \mathcode\! / 4096\relax`. – frougon Aug 24 '21 at 08:50\mathinnerhere https://tex.stackexchange.com/a/173740/1090 – David Carlisle Aug 24 '21 at 08:53\left...\right). – Gaussler Aug 24 '21 at 08:58ma thinner. Most women, especially mothers, don't want to hear of it. I certainly avoid discussing the issue of\mathinnerwith my wife. – Steven B. Segletes Aug 24 '21 at 09:24\showthewill stop as if for an error and show the number. – David Carlisle Aug 24 '21 at 15:52\showthewith\theto obtain the result in the DVI or PDF output, but you'd be better off learning how to read TeX's messages. – frougon Aug 24 '21 at 16:04\numexprrounds to the nearest integer (rather than truncates), one should use this instead:\showthe\numexpr (\mathcode\! -"800) / "1000\relax. Without this, the result would be (class number + 1) in case the family number in the\mathcode` were greater than or equal to 8. – frougon Aug 25 '21 at 10:34l.4 ...e\numexpr (\mathcode! -"800) / "1000\relax`
– Didier Aug 27 '21 at 06:275is correct: this is the class number corresponding to a Closing atom as produced by\mathclose—see the table p. 154 of the TeXbook, which is reproduced here. – frougon Aug 27 '21 at 07:34