Fact The file-name of the default font for a pdfTeX-compiled LaTeX document on my system is
cmr10. (How do I know?\fontname\font. See here.)Fact The font defined in the file
cmr10has a glyph of the Greek capital letter lambda at code point 3, and a glyph of the mathematical symbol for the empty set at code point 31. (How do I know?\fonttable{cmr10}. See here.)
Consider the following (La)TeX manuscript, inspired by this answer.
\documentclass{article}
\begin{document}
\def\foo{1}
\chardef\foo=3\foo
\end{document}
Compiling the manuscript with pdfTeX Version 3.14159265-2.6-1.40.18 (TeX Live 2017) results in a pdf file, whose body consists of a single letter: a Greek capital letter lambda.
This goes contrary to my expectations that the body of the pdf would consist of the mathematical symbol for the empty set.
What did I base my expectation on? On Donald Knuth's The TeXbook, 20th revised printing (Addison-Wesley 1991), where, on p. 215, he lists all the cases when expandable tokens are not expanded.
If you peruse the list you will notice that in the case of \chardef, macro expansion is inhibited only in the stage of reading the control sequence to be defined. (Compare this to, say, \def, where expansion is additionally inhibited while absorbing the parameter text and the replacement text.)
Returning to the manuscript I started with, it can be deduced from Knuth's list of non-expandables that the second occurrence of control sequence \foo in the line
\chardef\foo=3\foo
is expanded. Note that at the time this expansion takes place the \chardef definition is still processing, so the control sequence \foo must still be defined as a macro with the replacement text 1. Hence this line redefines \foo to be \char31.
Interestingly, the following, similar manuscript produces the expected result (i.e. the empty-set symbol).
\documentclass{article}
\begin{document}
\def\foo{1}
\chardef\bar=3\foo\bar
\end{document}

\relax, not relying on what can be tricky-to-follow (though documented) behaviour of other tokens. – Joseph Wright Jun 23 '17 at 08:35