velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <ge...@adeptra.com>
Subject Re: Default to quiet references
Date Wed, 27 Nov 2002 19:06:07 GMT
Some might argue that you should put a default value in the data model 
- i.e. it shouldn't be up to the template.

On Wednesday, November 27, 2002, at 01:47 PM, Matías Giovannini wrote:

> On Wednesday, November 27, 2002, at 03:25 PM, Serge Knystautas wrote:
>
>> Peter Romianowski wrote:
>>> This is bordering on the undesired feature that you can't tell what 
>>> the syntax means from looking at the code.
>>> Some feel (I'm 50/50) that if you see $!foo, that it should do one 
>>> thing, not be controlled by some outside switch. +1 on that. It 
>>> would mess up things. If you need such a feature
>>> you should do something like Andy Lee supposed.
>>> Just my $0.02
>>> Peter
>>
>> Yeah, I'd have to agree after thinking about it for exactly that 
>> reason... you can't know the syntax just from the code.
>>
>> I'll just do my best to educate users why they need to put $! 
>> everywhere.
>
> The problem is, it might not be needed *everywhere*. For instance, 
> suppose you want to put a label when some variable is undefined, as in 
> "N/A".
>
> I have a macro #isnull($var, "default") that I use in the cases that 
> silencing is not really appropriate:
>
> #macro (isnull $x $dflt)
> 	#if ($x) $x
> 	#else $dflt
> 	#end
> #end
>
> HTH,
> Matías.
>
> --
> To unsubscribe, e-mail:   
> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:velocity-user-help@jakarta.apache.org>
>
>
-- 
Geir Magnusson Jr                                   203-355-2219(w)
Adeptra, Inc.                                       203-247-1713(m)
geirm@adeptra.com


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