According to the Velocity User's Guide
[http://jakarta.apache.org/velocity/docs/user-
guide.html]:
[blockquote]
When passing references as arguments to Velocimacros,
please note that references are passed 'by name'.
This means that their value is 'generated' at each
use inside the Velocimacro. This feature allows you
to pass references with method calls and have the
method called at each use. For example, when calling
the following Velocimacro as shown
#macro( callme $a )
$a $a $a
#end
#callme( $foo.bar() )
results in the method bar() of the reference $foo
being called 3 times.
[/blockquote]
If, in this example, $foo.bar() returns "Hello", we
would expect the macro's output to be "Hello Hello
Hello"
In NVelocity, the result of the macro is
instead "$foo.bar() $foo.bar() $foo.bar()"!
I verified with the current version of Java Velocity
(1.4), that it works as documented, and it does. (I
added a new Template test case, velocimacro3.vm which
looks like this):
[code]
#macro( callme $a )
$a $a $a
#end
#callme( $provider.getName() )
[/code]
The expected output is:
[output]
jason jason jason
[/output]
Interestingly, the desired functionality doesn't seem
_completely_ broken. #callme( $provider ) returns the
result of provider.ToString() three times.