On Fri, Oct 3, 2008 at 1:30 PM, Vincent Massol <[EMAIL PROTECTED]> wrote:

>
> On Oct 3, 2008, at 1:17 PM, Sergiu Dumitriu wrote:
>
> > Vincent Massol wrote:
> >> On Oct 3, 2008, at 12:18 PM, Sergiu Dumitriu wrote:
> >>
> >>> Pascal Voitot wrote:
> >>>> OK,
> >>>> I don't have solved everything but I have found the origin of the
> >>>> stackoverflow...
> >>>> I coded a Recursive VelocityMacro and apparently variables inside
> >>>> VM macro
> >>>> are not local and it makes my recursion infinite!!!
> >>>> Apparently, there is an option in velocity to make local macro
> >>>> variables
> >>>> have only a local scope. Do you see any problem about this?
> >>> Yes, I had my share of pain with the fact that variables defined
> >>> inside
> >>> macros are global... I am +1 for making them local, but all the
> >>> macros
> >>> should be checked, since some of them might use this "feature".
> >>
> >> Velocity Macros *are* local (i.e. we're using the local macro
> >> configuration option from Velocity).
> >>
> >>           <property>
> >>             <name>velocimacro.permissions.allow.inline.local.scope</
> >> name>
> >>             <value>true</value>
> >>           </property>
> >>
> >> However for the include feature of XWiki Syntax 1.0 to work we have a
> >> hack in the velocity module to allow macros to span more than 1
> >> document.
> >> This is not required for the XWiki Syntax 2.0 (AFAIR) but we need it
> >> for the 1.0 syntax to continue working.
> >>
> >
> > Vincent, this is not about macros, but about $variables used in
> > macros.
> > For example:
> >
> > #macro(doSomething)
> > #set($a = 'b')
> > #end
> >
> > #doSomething()
> > $a => prints b, $a is now a global variable outside the scope of the
> > macro.
>

Yes this is another config property to set to true...
In fact, I don't understand why variables are not local by default in
velocity... I don't see any serious language where this is not the case...
ok velocity is not a language ;)



>
> oh ok. We can easily add a new parameter to the {{velocity}} macro (as
> it's done for the {{include}} macro).
>


Do you mean you can modify the velocity engine config on the fly?




>
> Thanks
> -Vincent
>
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to