[Bug 24726] map:new() and map:merge()

https://www.w3.org/Bugs/Public/show_bug.cgi?id=24726

--- Comment #5 from Michael Kay <mike@saxonica.com> ---
The WG looked at this today and agreed that it would be a good idea to try and
find function names that more closely matched the tasks being performed,
however elegant it might appear to have one multi-purpose function. The editor
was asked to produce a proposal.

I'm inclined to go with the following:

(1) To create an empty map, use either map{} or map:merge(()).

(2) map:merge() acts lile the current map:new() - it takes a sequence of maps
and merges them into a single map, resolving duplicate keys.

(3) To add an entry to a map (creating a new map), use map:put($map, $key,
$value). The new entry replaces any existing entry with the same key. This
function works well with the new function chaining operator: map{} =>
map:put("a", 1) => map:put("b", 2) (though of course simple cases like this can
be done equally well with a map expression).

(4) map:entry() which creates a singleton map, can now be dropped. Anyone who
really wants this function can either use map expressions, or implement it as 

let $map:entry := map:put(map{}, ?, ?)

So we end up with two functions map:merge() replacing map:new(), and map:put()
replacing map:entry().

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 24 April 2014 18:57:47 UTC