Indexing access for Lists and Maps considered harmful?

spamolovko spamolovko at gmail.com
Tue Jun 23 23:38:08 PDT 2009


Hello.

Joshua Bloch wrote:
> Folks,
>
> Hi.  Sorry I'm late to the party; I'm just recovering from a pretty bad
> cold.
>
> I agree that this is not a showstopper.
>
> I think it's *critical* that the behavior be defined to match the "expected"
> behavior.  These *must* function identically:
>
>    myArray[i] = myArray[j] = val;
>
>    myList[i] = myList[j] = val;
>   
+1, Totally agree with you.

But many people in this mail list forget that "myList[i] = myList[j] = 
val;" have 3 operations.

because it PUT val into myList[j], then GET from myList[j] and PUT it 
into myList[i]. Do not forget about getter!!!
> When extending a language, it's critical to enable reasoning by analogy; to
> do otherwise *will* cause bugs and ill-will.  (See this 20-year-old paper
> for my take on the topic:
> http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=37945 .)
>
>     Josh
>
>
>   




More information about the coin-dev mailing list