Have been using map lately. Had a case where I have two maps of the same
signature (key and value types) that I want to merge. The loop was trivial,
but what does append not work for this?
Proposal a=append(a,b) where a and b are maps of identical signature does
the obvious thing. You might think that the assignment of a is redundant,
but a good implementation will append the shorter to the longer and thus
either a or b could be the return value.
My thinking here is that doing it inside the map magic mah be faster than I
can do from outside.
Comments?
Michael
P.S. Not being lazy. I did this a week ago. Just thinking that if the logic
of copy or append or which ever make sense for maps worked there too, then
the orthogonality would make it seem less complex rather than moreso.
P.P.S If this idea finds a good home, we could also have copy that does
this:
with:
var a []A
b map[B]A
a = append(a, b)
appends the type A elements of b to a
Michael T. Jones | Chief Technology Advocate | mtj@google.com | +1
650-335-5765