[Andromda-devel] AndroMDA/JIRA Commented: (TEMPENG-1) Fix scope of velocity macros
[ http://jira.andromda.org/browse/TEMPENG-1?page=comments#action_11760 ] Alexander Gordt commented on TEMPENG-1: --- HiHi! I tried to use the parameter velocimacro.context.localscope = true but it didn't change anything for me. Have you tried to solve the problem or is it a more complicated bug, that won't be fixed in the near future? I assume, that I haven't found the correct place to set the parameter... Kind regards, Alex Gordt Fix scope of velocity macros Key: TEMPENG-1 URL: http://jira.andromda.org/browse/TEMPENG-1 Project: Template Engines Type: Bug Components: Velocity Reporter: Chad Brandon Assignee: Chad Brandon Shouldn't we set velocimacro.context.localscope = true? The docs say that this property controls whether reference access (set/get) within a Velocimacro will change the context, or be of local scope in that Velocimacro. Test this VTL code snippet here: #macro (MyMacro $argument) argument before: $argument #if ($argument 5) #set ($x = $argument+1) #MyMacro($x) #end argument after: $argument #end Invoke it with #MyMacro(1). You will get this output: argument before: 1 argument before: 2 argument before: 3 argument before: 4 argument before: 5 argument after: 5 argument after: 5 argument after: 5 argument after: 5 argument after: 1 I would have expected: argument before: 1 argument before: 2 argument before: 3 argument before: 4 argument before: 5 argument after: 5 argument after: 4 argument after: 3 argument after: 2 argument after: 1 The reason is that $argument is a global variable, not a variable that is local to the macro. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.andromda.org/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click ___ Andromda-devel mailing list Andromda-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-devel
Re: [Andromda-devel] AndroMDA/JIRA Commented: (TEMPENG-1) Fix scope of velocity macros
Where did you set the property? Alexander Gordt (JIRA) wrote: [ http://jira.andromda.org/browse/TEMPENG-1?page=comments#action_11760 ] Alexander Gordt commented on TEMPENG-1: --- HiHi! I tried to use the parameter velocimacro.context.localscope = true but it didn't change anything for me. Have you tried to solve the problem or is it a more complicated bug, that won't be fixed in the near future? I assume, that I haven't found the correct place to set the parameter... Kind regards, Alex Gordt Fix scope of velocity macros Key: TEMPENG-1 URL: http://jira.andromda.org/browse/TEMPENG-1 Project: Template Engines Type: Bug Components: Velocity Reporter: Chad Brandon Assignee: Chad Brandon Shouldn't we set velocimacro.context.localscope = true? The docs say that this property controls whether reference access (set/get) within a Velocimacro will change the context, or be of local scope in that Velocimacro. Test this VTL code snippet here: #macro (MyMacro $argument) argument before: $argument #if ($argument 5) #set ($x = $argument+1) #MyMacro($x) #end argument after: $argument #end Invoke it with #MyMacro(1). You will get this output: argument before: 1 argument before: 2 argument before: 3 argument before: 4 argument before: 5 argument after: 5 argument after: 5 argument after: 5 argument after: 5 argument after: 1 I would have expected: argument before: 1 argument before: 2 argument before: 3 argument before: 4 argument before: 5 argument after: 5 argument after: 4 argument after: 3 argument after: 2 argument after: 1 The reason is that $argument is a global variable, not a variable that is local to the macro. --- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click ___ Andromda-devel mailing list Andromda-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-devel
[Andromda-devel] AndroMDA/JIRA Commented: (TEMPENG-1) Fix scope of velocity macros
[ http://jira.andromda.org/browse/TEMPENG-1?page=comments#action_11761 ] Chad Brandon commented on TEMPENG-1: Where did you set the property? Fix scope of velocity macros Key: TEMPENG-1 URL: http://jira.andromda.org/browse/TEMPENG-1 Project: Template Engines Type: Bug Components: Velocity Reporter: Chad Brandon Assignee: Chad Brandon Shouldn't we set velocimacro.context.localscope = true? The docs say that this property controls whether reference access (set/get) within a Velocimacro will change the context, or be of local scope in that Velocimacro. Test this VTL code snippet here: #macro (MyMacro $argument) argument before: $argument #if ($argument 5) #set ($x = $argument+1) #MyMacro($x) #end argument after: $argument #end Invoke it with #MyMacro(1). You will get this output: argument before: 1 argument before: 2 argument before: 3 argument before: 4 argument before: 5 argument after: 5 argument after: 5 argument after: 5 argument after: 5 argument after: 1 I would have expected: argument before: 1 argument before: 2 argument before: 3 argument before: 4 argument before: 5 argument after: 5 argument after: 4 argument after: 3 argument after: 2 argument after: 1 The reason is that $argument is a global variable, not a variable that is local to the macro. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.andromda.org/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click ___ Andromda-devel mailing list Andromda-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-devel