4 ms·
Macros cannot reach back like that, no. The renaming of the variable is due to sweet's hygiene system that operates on the program as a whole - if two variables
by jlongster 8y ago
Macros cannot reach back like that, no. The renaming of the variable is due to sweet's hygiene system that operates on the program as a whole - if two variables with the same name exist in the same scope it will rename them to ensure uniqueness.
- ianbicking 8y agoBut then shouldn't the rewriting be like this? var foo = 5; var tmp = 6; var tmp$1 = foo; foo = tmp; tmp = tmp$1;
- jlongster 8y agoIt could rewrite it like that, yeah, but sweet renaming all collided variables, likely to make it clear that they collided. It doesn't try to keep the distinction between what a macro introduced and what was already in scope (not worth the complexity). This was back in 2014 though and sweet has changed a ton since then, so the output is probably different