[bug?] #addAll: for SortedCollection

ChrisRath at aol.com ChrisRath at aol.com
Sat Jul 31 23:27:20 UTC 1999


Came across a quirk in the behavior of the #addAll: for SortedCollections.  
If you run the following snippet, you should get a different kind of result 
for the return value of the message than you do for any of the other standard 
collections.

| x y |
x := #(1 2 3) asOrderedCollection.
y := x addAll: #(7 8 9).        "returns #(7 8 9)"
Transcript show: y printString; cr.

x := #(1 2 3) asSortedCollection.
y := x addAll: #(7 8 9).        "returns Sorted Collection (1 2 3 7 8 9)"
Transcript show: y printString; cr.

I ran the code under VW, and in both instances it returns the array that is 
being added, not the overall collection.  Looking at the implementation of 
#addAll: method for SortedCollection, it appears that no value is explicitly 
returned.  Not an earth shattering quirk, but perhaps it should be looked at.





More information about the Squeak-dev mailing list