julia
8190fe87 - Rewrite most gensym macros to use automatic hygiene instead (#59239)

Commit
143 days ago
Rewrite most gensym macros to use automatic hygiene instead (#59239) Manual `gensym` code often contains a lot of mistakes, either because the user uses something like `.` or `+`, or because it combines code from multiple modules (gensym is only unique within a pre-compile unit). This replaces most uses for macro local variables with proper scope markers. I did not rewrite `_lift_one_interp_helper` or `replace_ref_begin_end_` however, since, while possible by adding `esc` to every argument that has not used a gensym value, if any other argument did is a value, I worried that could lead to macroexpand.scm making more new mistakes so I left if for a separate PR. Better yet, we could make a unhygienic-scope and unescape pair for marking the inverse/dual of the usual operations (marking a symbol as unescaped within a region of unhygienic (escaped) code to make these various uses easier to implement. But also do rewrite `replace_ref_begin_end_` to respect argument order and evaluation count (similar to its julia-syntax.scm counterpart) and scoping (not adding `let` unpredictably).
Author
Loading