DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30343>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30343

recursion and loop

           Summary: recursion and loop
           Product: Velocity
           Version: 1.4
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Source
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


It seems that there is a bug when we have loop into a recursive macro.

Here is the test I run :

#macro (test_loop $p)
call to test_loop ($p)
#foreach($child in $p)
    in the loop the param should not be changed : ($p)
#test_loop($child)
#end
return
#end

#set($l1=["a"])
#set($l = [$l1])
#test_loop($l)


It produce:

call to test_loop ([[a]])
        in the loop the param should not be changed : ([[a]])
call to test_loop ([a])
        in the loop the param should not be changed : (a)
call to test_loop (a)
return
return
return

IMHO, it should be 
call to test_loop ([[a]])
        in the loop the param should not be changed : ([[a]])
call to test_loop ([a])
        in the loop the param should not be changed : ([a])
call to test_loop (a)
return
return
return

The difference is in the second recusive call.  I don't know why, but it seems
that the instruction #foreach($child in $p) has modified $p that contains the
value of $child.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to