As promised, but late, there is a new vel.jar and other stuff in
whiteboard/geir.  What I am looking for is a few people to give it a
shakedown to see how it works.  I will warn you now it is slower, but it
works correctly.  The current implementation in CVS is faster, but
buggy.  So anyone that tortures the VM system (like Jose :), it would be
appreciated if you could take a shot with this jar to make sure it's ok.

If you find a problem, doublecheck to make sure the output with the
current CVS is actually right...  either way, say something : I am
interested in the problems with the current impl as well to make test
bed cases.

Things to note : 

1) The whole arg handling mechanism has been redone.  It is no longer
'patch-and-parse', but rather living proxy objects are used to care and
feed the dynamic VM args (like references, string lits, ranges
[1..$foo], anything that has a reference in it...).  Macros are still
parsed in the VMProxy init method, for reasons pertaining to supporting
both recursion and template-local VMs.  But we all realize it isn't a
big deal if you cache, right ? ;-)

2) There is a wrapping mechanism with the new context class (used
internally) that was needed to care and feed those VM proxy arg
objects.  Its internal, nothing will change outside on the app side.
Currently, it behaves as normal, namely if you access a reference in a
VM that isn't an arg, it's global :

#macro(foo $a )
  #set($b = $a )
#end

would modify the global $b reference.  It's a very simple addition of a
switch to get the local scope feature, so we can talk about that.

3) You can do things that you couldn't do before, but should have, such
as pass a string literal with a space in it :

#macro( foo $a )
  $a
  #bar($a)
#end
#macro( bar $a )
  $a
#end

#foo("Hello Geir")

now works right.  The output is something like
   Hello Geir
     Hello Geir
where before the #bar() call would fail.  Thx to Jason for discovering
the bug and keeping the pressure on to fix all this.

4)  Yes, it slower.  A monster stress test that I use went from about
~15sec to 18.5sec.  Not a killer hit, but I don't like it.  But I will
say that it does work correctly, so thats a plus :)  I have been working
hard to find where, removing every cast, instanceof, and new that I
can.  It's pretty clean, but I will keep looking.

5) There are examples in the directory.  "./test.sh xxx.vm ; more
output" should work right for all of them.  the geir*.vm ones are there
to demonstrate the specific issues I was making sure worked.  These will
be bound up into a one for the testbed later.  If you have any more, let
me know.

6) The most fun is the xml.vm template, a little VM that recursively
walks a JDOM tree.  I included the setup of the tree in the Test program
in teh jar, and included the code for people to see.  The code in
Test.java is no big deal.  The fun is in the VM. To run it, do ./test.sh
xml.vm ; more output

Thanks in advance for taking a few minutes to find the bugs...  if all
is well, I will check the code in real-soon-now.  There are enough
changes, and those changes are deep and complicated enough (to me,
anyway) that I don't want to do it until I am sure things are reasonably
good.  Don't want to break anyone...

geir

-- 
Geir Magnusson Jr.                               [EMAIL PROTECTED]
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

Reply via email to