"Geir Magnusson Jr." <[EMAIL PROTECTED]> writes:

> "Geir Magnusson Jr." wrote:
> 
> > So I propose :
> > 
> > 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<-
> 
> 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.

I must confess that I am much more used to the opposite behavior,
where the symbolic reference $a first evaluates to the symbol
$notincontext, then $notincontext renders literally because it's not
in the context.  However, I would be okay with either of these forms,
so long as the behavior is clearly defined in the documentation.

Daniel

Reply via email to