Indexing access syntax for Lists and Maps
Ulf Zibis
Ulf.Zibis at gmx.de
Wed Jul 22 09:57:54 PDT 2009
Am 22.07.2009 16:49, Joshua Bloch schrieb:
>
> For what it's worth, I believe it *is* a clear winner. The arguments against
> it confuse implementation with interface. No one is going to worry about
> how its implemented. People will want the same sort of polymorphism offered
> by the for-each statement. If you have:
>
> a[i] = a[j] = k;
>
> the behavior must not differ depending on whether a is an array or a list.
>
+1; very simple and clear, all mapping issues against underlying just
existing map/list/etc/API should be solved by compiler.
Just adding to recent discussion about the print question:
We could distinguish between:
print(map["foo"] = 123); // prints 123
print((map["foo"]) = 123); // prints 123
print(old = (map["foo"] = 123)); // prints old
- Ulf
More information about the coin-dev
mailing list