API / Apache Velocity Interview questions
Explain the internal working of Velocimacro resolution and invocation?
Calling a macro like #greet("Alex" true) triggers a distinct lookup and binding sequence separate from ordinary directive handling.
Argument binding is positional and happens by reference substitution: each parameter name inside the macro body is treated as a stand-in for whatever expression was passed at the call site, evaluated fresh on every invocation rather than passed by value once. This is why passing a reference (like $currentUser) into a macro reflects that reference's live value at each point the parameter is used inside the macro body, rather than freezing it at call time.
More Related questions...