%%% Pawe\l{} Jackowski: \relax ex machina

Guess what is the meaning of macros in the following cases:

\beginverbatim
\edef\stra{\csname undefined\endcsname}
\edef\strb{\ifnum0=1\else\fi}
\edef\strc{\ifnum0=0\else\fi}
\edef\strd{\relax}

\meaning\stra % -> \undefined (plus side effect alike \let\undefined\relax)
\meaning\strb % -> (empty)
\meaning\strc % -> \relax
\meaning\strd % -> \relax
\endverbatim

\dots and can you explain why \verbatim|\ifx\strc\strd| is false, although both control
sequences have the same meaning?

\beginverbatim
\ifx\strc\strd true\else false\fi \message{?\strc?\strd?}
\endverbatim

Since the behavior of \relax is somewhat weird, I've learned to dislike
the \relax acting as the universal string delimiter in cases such as

\beginverbatim
\def\gobbler#1\relax{}
\expandafter\gobbler\strc whatever \relax

\def\iterator#1{%
  \ifx\relax#1\else\message{Can you see that #1?!}%
  \expandafter\iterator\fi}
\expandafter \iterator \stra whatever \relax
\endverbatim

Instead I propose

\beginverbatim
\def\endstr{\noexpand\endstr}
\endverbatim

-- no endless loop in spite of recursion (expands to itself) \par
-- alike \type{\relax}, \type{\endstr} returns nothing (a sort of...) if typeset\par
-- side effect is that \type{\endstr} stops assignments (as \type{\relax} do)\par
-- \verbatim|\ifx\endstr\relax| is false, so we can distinguish them\par
-- but be careful: \verbatim|\if\endstr\relax| is true\par


