Menu

#7 Fix new map type to better handle "put"

v2.0
open
nobody
7
2003-08-03
2003-08-03
Marc Palmer
No

Currently the new map syntax creates hashtables/maps
with the Map interface of:

Object put(Object k, Object v)

This is problematic in templates as:

#set $map.Value = "oooops!"

Will output:

oooops!

In the template output! We must fix this, it is not useful
like this. I propose either:

1. a non-Map implementation with put that does not
return anything. I think a much simpler non-Java
interface would be better (i.e. getPropertyNames(),
getPropertyValues(), getPropertyValue(pname),
getCount(), get(pname) and put (pname).

2. a Map implementation that proxies to the real Map
implementation, returning "" from all put methods. Seems
wasteful and inefficient.

3. a binary accessor: void set(key, value) added to a
class that derives from Hashtable - but this relies on
binary accessor logic in POC picking it up BEFORE put().

Discussion


Log in to post a comment.