3 ms·
What about global optimizations? Macros operate on local expressions only effectively. Things like global alias analysis still needs to be done outside them.
by rahulgarg 18y ago
What about global optimizations? Macros operate on local expressions only effectively. Things like global alias analysis still needs to be done outside them.
- gruseom 18y agoPresumably you have the entire program represented as a top-level tree, and a global optimization would be a transformation of that. I don't see why macros wouldn't be just as applicable here as in the local case where you're transforming a subtree.
- rahulgarg 18y agoI guess u are right. Macros people usually write are local but macros are just AST transformers after all. I was confusing between what happens during macro expansion (arbitrary computation including lets say doing any analysis and building metadata) versus the result of the macro expansion (a transformed AST).