Indexing access for Lists and Maps considered harmful?

Lawrence Kesteloot lk at teamten.com
Mon Jun 22 13:40:16 PDT 2009


On Mon, Jun 22, 2009 at 12:19 PM, Joseph D. Darcy<Joe.Darcy at sun.com> wrote:
> map["a"] = map["b"] = "c";
>
> the new value for key "a" would be the old mapping of "b" and not
> necessarily "c" because a call to the put method returns the old value.

There is no way that:

    map["b"] = "c"

can return anything other than "c". Returning the old value or
returning void would violate 40 years of C-based expectations
(including the identical construct in the STL). It must either return
"c" or not be implemented at all.

Lawrence



More information about the coin-dev mailing list