Hi all, If Velocity were to support null, how would you expect it to behave?
Some thoughts: 1. The word "null" should be treated as null in Velocity specific content. eg. #set ($list = ["one", null, "three"]) should make a 3 element list, with the elements "one", null and "three". $foo.bar(null) should call the "bar" method of the "foo" object with a null parameter. 2. The "set" directive should accept null value as the RHS. eg. Assuming that $bar wasn't in the Context, #set ($foo = $bar) #set ($foo = null) should both remove "foo" from the Context. 3. The "foreach" directive should set null when the element is null. Currently, it preserves the last element. eg. #set ($list = ["one", null, "three"]) #foreach ($foo in $list) $!foo #end should output: one three 4. The "if" directive should be able to compare references with null. eg. #if ($foo == null) foo is null #end should output foo is null if foo was not in the Context. if ($foo != null) foo is not null #end should output foo is not null if foo was in the Context. Any comments, opinions, etc.? Related bugzilla issues: http://issues.apache.org/bugzilla/show_bug.cgi?id=20999 http://issues.apache.org/bugzilla/show_bug.cgi?id=27741 Related list postings: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&by=thread&from=949954 Best regards, -- Shinobu Kawai -- Shinobu Kawai <[EMAIL PROTECTED]> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
