velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Lee <ag...@earthlink.net>
Subject Re: Default to quiet references
Date Mon, 04 Nov 2002 05:11:41 GMT
At 6:00 PM -0500 11/3/02, Serge Knystautas wrote:
>What I'd like to do is have a configuration setting have $foo act 
>like $!foo, so $foo never gets printed in the output.
>
>Are other people interested in this and/or give me any pointers as 
>to where in the code I should look to make this kind of change?

I know you're asking about adding a configuration option to the 
language, but have you considered using a macro?  Something like:


$set( $forceQuiet = false )

#macro( qu $foo )
#if( $forceQuiet )$!foo#else$foo#end
#end


On the one hand, this is cumbersome if you have a lot of $foo's in 
your code.  On the other hand, you can mix quiet references with 
conditionally quiet references, if for some reason you want to. 
(Don't ask me why, I'm just saying "if.")  You could do:


$foo          ## never quiet
$!foo         ## always quiet
#qu( $foo )   ## quiet iff $forceQuiet is true
#qu( $!foo )  ## doesn't make sense to use


BTW, I find it amusing that "quiet" references are indicated by the 
"bang" character.  I suspect the language designers found it amusing 
too.

--Andy

--
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