Indexing access for Lists and Maps considered harmful?
    Tom Hawtin 
    Thomas.Hawtin at Sun.COM
       
    Mon Jun 22 12:35:35 PDT 2009
    
    
  
Joseph D. Darcy 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.
> 
> I'm not too concerned about this interaction because compound assignment 
> is relatively infrequent; however, I think a lint warning from the 
> compiler would be appropriate in this case.  [...]
My interpretation of Java's feel is that there should be no warnings. If 
something is really dodgy it shouldn't compile. I understand, warnings 
were added later as a kludge.
As this is a new feature, there is no need for it to be a warning. The 
construct should be outlawed, probably by making this new feature 
effectively return void.
Tom Hawtin
    
    
More information about the coin-dev
mailing list