Omni Systems, Inc. Mif2Go User's Guide, Version 55
> 28 Working with macros > 28.6 Using expressions in macros > 28.6.7 Using indirection in expressions
Suppose you assign a variable to another variable, as follows:
Then, if you subsequently use:
you get whatever contents the variable named
$$other
had at the time you assigned it to
the variable named $$myvar
. Suppose you specified
the original assignment like this:
Then, if you subsequently use:
all you get is the literal string “$$other
”.
If instead you use:
you get the current
contents of the variable $$other
(but if there
were no variable named $$other
, you would get
just the literal string “$$other
”).
The same thing works through multiple layers. If you use this series of assignments:
then, subsequently, the contents of <*$$myvar>
is “here
”, which is the same as
the contents of <*$$other>
, or of <$$whatever>
,
or even of <*$$whatever>
.
<$$other> gives: something else
<*$$myvar> gives: something else
However, a built-in circular-reference counter saves you from the natural consequences of this last foolish assignment. The counter prevents indirection through more than 128 levels.
The top-level variable is like an envelope that can contain more nested envelopes; you continue opening them until you get to the letter (the contents). You can use indirection to recurse, to process variables and expressions, and so forth, down to a simple value, through whatever layers that takes.