Out of curiosity I wanted to find the limits of TeX regarding macro definitions. Assume there should be an assignment command which assigns the value of an already defined macro to a yet undefined macro, so something like
\def\newVariable{\variable}
just with the syntax usually find in other languages, i.e. using the equal sign as an assignment operator.
I guess it's not possible to write
\newVariable = \variable
as this results in an 'Undefined control sequence' when \newVariable is read. Is it possible to hook into the execution of whatever detects the undefined control sequence and look ahead with @ifnextchars for an equal sign and an macro?
What were if we'd write
newVariable = \variable
Now this should at least run without error. When \variable is expanded, is there any chance to remove the text newVariable = from the output string again (do some sort of rewinding) and use it in \variable as an option similar to \variable{newVariable}? So I guess here I would look for something like \@iflastchars. I am all open for bizarre solutions with all TeX flavours like finding the string in the output routine or in the aux or even in the PDF file produced by the last run (or any of the other output files).
I guess the answer will be "this is not possible", but as there are a lot of smart people around liking a challenge, I thought I'd give it a try. Please note, that I am fully aware of the solution with the normal TeX syntax so this is a more a theoretical exercise.

\variableto be expanded? (It doesn't get expanded in\def\newVariable{\variable}.) – Ian Thompson Oct 8 '12 at 18:45=for assigment, you just have to use\letas well:\let\newVariable = \variable. You can use=for counters and lengths:\c@section = 5,\footskip = 5mm. However, in LaTeX, you better avoid these low-level format if you don't need them. You must think of (La)TeX as of a "different programming language" that has its very strange specifics ;) – tohecz Oct 8 '12 at 18:47\variablewould be expanded after reading the equal sign, as otherwise there is no chance of changing the execution. If it gets expanded it could do whatever it wants to hide the expansion to the outside if that is wanted. If you find a solution without expansion that would also be great. – MMM Oct 8 '12 at 18:54\letis left of the\newVariable(it's the same with\def) or because the thing is already defined (for counters and lengths). I guess my question could be reformulated as: Is this possible with yet undefined macros without having a macro like\leton the left? – MMM Oct 8 '12 at 18:58=as a "text" and "math" character with its real meaning to the "normal" people. I think that doing this is impossible because TeX reads its input lineary and invokes an error on an unknown macro in the input sequence. – tohecz Oct 8 '12 at 19:11