DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27741>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27741





------- Additional Comments From [EMAIL PROTECTED]  2004-12-20 10:00 -------
The historical source of why velocity does not handle nulls:
Originally vel started off with the posibility of using a simple Hashtable
as the context - which does not allow nulls.

a) If we where allowed to set null into the context - no problem.

b) We could also wrap the user context into a chained one with only
   the #foreach var - which does allow setting it to null.
   -> This could raise some BC problem, since after the #foreach loop
      the original context may be restored, but the application wants
      to see the last value we had in the loop.

c) When setting null into the map value is not allowed, removing the key
   could yield the desired result.
   -> but beware... if the context was a chained context, the parent
      key could suddendly show - ugh.
   -> also beware that the parent context could be read-only and thus
      may not be altered...

d) The best solution is to have a pre-made key=null context at hand in the
   foreach directive instance to overlay it as a chained context every
   time a null is encountered. Wihtin the #foreach all non-null calls
   should be delegated to the user context; setting the #foreach var
   to non-null should also disable the key=null chained context.

Hope this helps to understand the whole problem.

I hope the coding of solution d) is easy as it could be made as an inner
class to the #foreach directive and could be lazily instantiated upon
the first use.

The solution d) is not possible for a #set directive, since it does not
have a body and thus it is not possible to overlay a chained context.
So the pittfalls of c) come to show...

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to