UDF map.merge gives unexpected behavior (possible bug?)

,

Up until now, I have been using the Map as a Set (i.e. non-null key, null value). And it works perfectly fine for operations like put, remove, size.

But in a map.merge() operation, entries with NIL values are removed in the final output. For example:

map1 = {"Peter":NIL, "Jane":NIL}
map2 = {}
map3 = map.merge(map1, map2, function(v1, v2) return v1 end)

In the above case, map3 is an empty map.

If null-value entries are valid in all the other operations (put, remove, size), I think these entries should survive a merge operation.

For now, a temporary solution is to use a dummy value like "0" in place of nil so entries will survive a merge. But I thought it would be good for others to know.