Different variables are given the same identifier
Created by: j201
http://sweetjs.org includes the following code as an example of hygienic renaming:
macro swap {
rule { ($a, $b) } => {
var tmp = $a;
$a = $b;
$b = tmp;
}
}
var tmp = 10;
var b = 20;
swap (tmp, b);
While different names are generated for the macro variable tmp
and the global tmp
in version 0.2.2 and earlier, 0.2.3 and 0.2.4 are giving me the following:
var tmp$111 = 10;
var b$112 = 20;
var tmp$111 = tmp$111;
tmp$111 = b$112;
b$112 = tmp$111;
;
The same happens in the web editor.