Macros as code modification tools
One of the first and most common uses of macros is to be able to modify code; they work on the code level, as you will see. Why should we do that? Let's try to understand the problem with something that you are more familiar with—Java.
Modifying code in Java
Have you ever used AspectJ or Spring AOP? Have you ever had problems with tools such as ASM or Javassist?
You have probably used code modification in Java. It is common in Java EE applications, just not explicit. (Have you ever thought about what the
@Transactional annotation does in Java EE or Spring applications?)
As developers, we try to automate everything we can, so how could we leave out our own devtools?
We have tried to create ways to modify the bytecode ...