Question

I have been testing some nested macro invocations, and they worked as expected (...as expected by me!) For instance, supposing a ficticious add macro and the following expression:

add(1, add(2, 3))

Firstly the inner add is expanded (2 + 3) and secondly the outter one does its part (1 + (2 + 3)). I have seen that the outter macro does not receive any noise from the internal invocation -in the input expression- so the inner expansion seems totally transparent to it. Does this fact always hold (even with more complex macros and types)? Is it safe to do so?

Was it helpful?

Solution

Innermost macros are always expanded first (even if they are provided as by-name arguments).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top