TCL has a feature which to me qualifies as a total "What the hell were they thinking?", not unlike the COME FROM command from Brainfuck, except, in a real language.
That statement is upvar [1]. Read its description and despair.
That statement is upvar [1]. Read its description and despair.
Think of it as similar to "passing value by reference", for example when you pass the address of a variable in C/C++.
upvar and uplevel seem scary/strange when you read about them, but once you start using them in code, they feel perfectly suited for the task.
I once did a web search to see whether there was an equivalent in PHP. I found a thread in at PHP forum, which told a poster that he was a bad person for wanting such a thing. (This was a long time ago, so perhaps I exaggerate. But they did say that PHP was just fine without it.)