velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject RFE: null support
Date Sat, 04 Dec 2004 15:11:43 GMT
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/BrowseList?listName=velocity-user@jakarta.apache.org&by=thread&from=949954

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu.kawai@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message