4.3.2 Immediate or deferred development

• As a command is witten as a string, right before executing it, TeXgraph has to analyze that string before transforming it into a tree. During that analysis, a macro may be immediately developed or not.
• When analyzing [\$a:=3, racine(a,i)]: TeXgraph builds the corresponding tree, while conserving the word racine. When the tree is evaluated, a copy of the macro’s expression racine replacing the \$1 parameter by the a variable 4 and the parameter \$2 by i, then evaluate the resulting expression 5 and destroy the copy: this is the deferred development.
• When analyzing [\$a:=3, $\$racine(a,i)]: TeXgraph replaces $\$racine with the macro’s expression, replacing the parameter %1 by the a variable and the parameter %2 by i, this is equivalent to analyze the command:
[\$a:=3,
if (Ent(a)=a) And a>0
then  \$a:= abs(i)^(1/a),
for \$k from 0 to a-1 do a*exp(i*(Arg(i)+\$k*2*pi)/a) od
fi]

This is the immediate development. We see that this time there is only one variable a. Therefore, that command won’t give the right result (it gives i). On the contrary the command [\$b:=3, $\$racine(b,i)] gives the right result ([0.866025403784+0.5*i,-0.866025403784+0.5*i,-i]). The immediate development can take place only if the macro already exists, else it is deferred development.

• Immediate development should be avoided when the macro has local variables and there is a risk of homonymous with the variables of the calling expression. Though, there are case where it is more interesting than the deferred development. For example, the macro called f by the command %1*arctan(%1)/(1+%1^2) and if the graphical element Curve/Parametric is created by the expression t+i*$\$f(t), then the expression will in reality be t+i*t*arctan(t)/(1+t^2) and as that expression will be many times evaluated, it will be faster than the expression t+i*f(t), because in a deferred development, the macro f will be called at each evaluation of the expression.

On the other side, immediate development also permits to use macros as variables or as shortcuts.

• Macros can be recursive.