I'd like to have a macro to split up another macro content, with field separator being a space. So:
\def\mytext{foo bar}
\def\secondof#1 #2{#2}
\secondof\mytext
What? What do you mean: "runaway argument"? Oh right, I guess \mytext counts as only one argument and you're expecting two. Ok, so
\expandafter\secondof\mytext
and indeed, the result is "bar", just as I was hoping for.
But alas, then comes something rather surprising:
\def\firstof#1 #2{#1}
\expandafter\firstof\mytext
"fooar"? You got to be kidding me! How on earth did you—dear and beloved TeX—ever come to such a ridiculous decision? You did so well with the \secondof, after all. What gives?
(just to make this a complete MWE, I'm going to add a \bye here)