velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Revusky <revu...@wanadoo.es>
Subject Re: What's in the future for Velocity?
Date Thu, 10 Oct 2002 21:54:33 GMT
On Thursday 10 October 2002 06:53 pm, Jason Weinstein wrote:
> I'd like to see the ability to denote the scope of variables.
>
> I'd especially like to have a local scope inside of a macro.
>
> #setlocal () perhaps

Well, FreeMarker, as of version 2.1, has this feature. It's

<local foo="bar">

from within a macro.

>
> I think there are other scoping issues that I would consider although I am
> not sure how velocity is handling scope for instance when a file is
> #include(d) or #parse(d) since I have not used these features.
>
> I'd also like to have an
> #endif
> #endmacro
> #endforeach
> for readability.
> (Name not important, just like to know what construct is ending)

You might like FreeMarker syntax in that case, since a macro is ended with 
</macro> and an <if> block ends with </if> and <foreach> with </foreach>
and 
so on.

>
> See example below for scoping issue.
>
> Calling the #macro sets $macroTemp, $macroI, $macroK globally. This makes
> it difficult to call another #macro from within a #macro do to possible
> naming conflicts.

Yeah, in terms of macros being reusable in a robust manner, one really needs 
to be able to have local variables.

Well, anyway, it's up to you. If you like Velocity, use that. OTOH, if you 
want to read more about what Freemarker has to offer, you can look here for a 
comparison of the two template engines.

http://freemarker.sourceforge.net/fmVsVel.html

And here is information about how to transition from Vel->FM, if that ends up 
being what you want to do. :-)

http://freemarker.sourceforge.net/usCavalry.html

Cheers,

Jonathan Revusky
--
lead developer FreeMarker http://freemarker.sourceforge.net
Build robust web applications with the Niggle Web Application Framework
http://www.niggle.org/

--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message