| Version 1 (modified by manualwiki, 14 years ago) (diff) |
|---|
Rename variable
The "rename variable" transformation renames a variable and all of its occurrences. The only semantic information it requires is the scope and visibility of the variables.
Rename X to Y:
max(X,Z) ->
if
X=<Z -> Z;
X>=Z -> X
end.
Result:
max(Y,Z) ->
if
Y=<Z -> Z;
Y>=Z -> Y
end.
Side conditions
- The new variable name does not exist in the scope of the variable, either as a defined variable or as a visible variable. If it exists then the transformation starts an interaction to ask for a new variable name.
- If the user does not specify a variable, the transformation starts an interaction to ask for a variable. It gives a list of variables which can be reached from the selected function clause.
Transformation steps and compensations
- Replace every occurrence of the variable with the new name. In case of variable shadowing, other variables with the same name are not modified.
