I am aware about order that macros are expanded.
Is it possible to write a generic macro which apply macro, lets say generate, to items generated by macro primitives?
for_each!( generate, primitives );
where for_each, generate, primitives are 3 macroses.
You might be looking for something called the Callback Pattern. This is where you modify the inner macros (i.e. generate and primitives`) to take the name of a callback macro which will be invoked on each item inside them.
It's a little different from your original example, but could you adapt something like this to your use case?
Thanks, that really solve the original problem. But in my case I have extra arguments applied to each type and attempt to use prefix in apply! does not work and it looks like a problem without solution.
Yes. Have a close look at the @ARGS( $Arg ) and compare it to @PREFIX( $( $Prefix )* ). You've also wrapped the entire Callback!() call in a level of repetition, but $Arg and $Prefix are unrelated.