You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@apache.org on 2002/02/14 20:40:00 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node ASTNotNode.java

geirm       02/02/14 11:40:00

  Modified:    src/java/org/apache/velocity/runtime/parser/node
                        ASTNotNode.java
  Log:
  Fix for bug reported by Chris Rousseau <Ch...@timerasolutions.com>
  
  where
  
    #set($foo = !$bar )
  
  wouldn't work.  I don't think there was ever a reson for not letting
  it be the logical compliment...
  
  Revision  Changes    Path
  1.4       +6 -0      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTNotNode.java
  
  Index: ASTNotNode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTNotNode.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ASTNotNode.java	19 Mar 2001 17:17:52 -0000	1.3
  +++ ASTNotNode.java	14 Feb 2002 19:40:00 -0000	1.4
  @@ -87,4 +87,10 @@
           else
               return true;
       }
  +
  +    public Object value( InternalContextAdapter context)
  +        throws MethodInvocationException
  +    {
  +        return ( evaluate( context ) ? Boolean.FALSE : Boolean.TRUE ) ;
  +            }
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node ASTNotNode.java

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/14/02 2:51 PM, "Jon Scott Stevens" <jo...@latchkey.com> wrote:

> on 2/14/02 11:40 AM, "geirm@apache.org" <ge...@apache.org> wrote:
> 
>> geirm       02/02/14 11:40:00
>> 
>> Modified:    src/java/org/apache/velocity/runtime/parser/node
>>                       ASTNotNode.java
>> Log:
>> Fix for bug reported by Chris Rousseau <Ch...@timerasolutions.com>
>> 
>> where
>> 
>>   #set($foo = !$bar )
>> 
>> wouldn't work.  I don't think there was ever a reson for not letting
>> it be the logical compliment...
> 
> Ok, I have a question here:
> 
> What if $bar resolves to null? What is the ! of null? Heck, what is the
> result of !$bar even if $bar returns a non null? Is it a Boolean?

A null is 'false' in VTL.  I donĀ¹t really like it, but we should be
consistent.
 
> I think that this syntax is rather confusing and very Perl'ish.

You bet.  

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"Now what do we do?"


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node ASTNotNode.java

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 2/14/02 11:40 AM, "geirm@apache.org" <ge...@apache.org> wrote:

> geirm       02/02/14 11:40:00
> 
> Modified:    src/java/org/apache/velocity/runtime/parser/node
>                       ASTNotNode.java
> Log:
> Fix for bug reported by Chris Rousseau <Ch...@timerasolutions.com>
> 
> where
> 
>   #set($foo = !$bar )
> 
> wouldn't work.  I don't think there was ever a reson for not letting
> it be the logical compliment...

Ok, I have a question here:

What if $bar resolves to null? What is the ! of null? Heck, what is the
result of !$bar even if $bar returns a non null? Is it a Boolean?

I think that this syntax is rather confusing and very Perl'ish.

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>