Hi,
 
I started really experimenting with Velocity this weekend and got a bunch of extrange
behavior, that I do not understand:
 
1) I could not use "-", "_", nor numbers in macro identifiers, got grammar errors.
    Things started to work when I remove them. However the tests suit and the documentation,
    and the grammar seem to say otherwise.
 
2) Given a macro, xyz, with no arguments, the documentation says invocation is: #xyz()
however, that would put "()" as part of the output. I had to use #xyz without parentesis.
 
So, is this some but somewhere? a non commited change to the grammar? Or what.
 
Some other things I noticed was that when evaluating macros, the entire body of the macro
gets reparsed everytime the macro is expanded. That seems like a very costly operation
when one has lots of macros (in my case I have lots and they are heavily called) I am
doig XML-XML translations with this.
 
I can see that such an approach is needed for interpolation (having snippets of code
expanded in place on the macro) but for that small use it seems that the price is
too big. An #eval($code) directive that specializes on this kind of thing seems to me
to be more approrpiate. This can really speed things up, at least in my case.
 
Am I misunderstanding how this stuff works?
 
Jose Alberto
 

 

Jose Alberto Fernandez.vcf

Reply via email to