"Geir Magnusson Jr." wrote:

> So I propose :
> 
> That I fix it.
> 
> The change would be -
> 
> When you call a VM with a non-existant reference, the rendered output
> will be simply the *literal form of the corresponding VM arg* if
> rendered in the VM, and #if() will work correctly - namely the value is
> null.
> 
> An example :
> 
> #macro( foo $a )
>  ->$a<-#if($a)yes#end
> #end
> 
> When called with a real value :
> 
> #set($lala = "hello")
> #foo($lala)
> 
> output
> 
> ->hello<-yes
> 
> and when called with something not in the context
> 
> #foo($notincontext)
> 
> output
> 
> ->$a<-
> 
> That would be the result of the change.

As a follow up - I think some may initially object to this behavior as
it's different than a regular reference in that you get the VM arg
reference rendered ($a) rather than the passed-in reference rendered
when it's null ($notincontext).

I think this is ok - because unlike a regular reference in a template,
where we render 'as is' because it is not a reference if not backed by
data in the context (ex.  $ave at our $ale on $aturday! ), in a VM, it
is clearly intended to be a reference because it's the formally declared
arg to the VM, so I think there is no harm in rendering the arg
reference token ($a, above) vs the arg reference.

Was thinking about it...

geir

-- 
Geir Magnusson Jr.                           [EMAIL PROTECTED]
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Reply via email to