Blog: Procedural Macros vs. Macros


#1

Wherein we expand, if not our mind, then at least our macros.


#2

That’s neat! I wouldn’t have though it would be that easy to expand a macro programmatically.

Does that mean you’re effectively expanding the macro and emitting the result back instead of the compiler doing it itself later?


#3

Thanks @llogiq, I’m in the design phase on a project in which I will probably have to do this. :slight_smile:


#4

Yes, but I get to manipulate it before emitting.

Edit: Note that it’s possible to work on bare token trees, too, but it’s not very ergonomic.