On Oct 5, 2009, at 3:42 59PM, Henrik Johansen wrote:


On Oct 5, 2009, at 3:19 53PM, Nicolas Cellier wrote:

2009/10/5 Henrik Johansen <henrik.s.johansen@veloxit.no>:

Of course, it's arguable that that's better behaviour for  
LinkedLists,
seeing as otherwise ll2's lastLink would be invalid when you added to
ll.
At a glance, SparseLargeTable, Stack (Through LinkedList
implementation) and WideCharacterSet in your changeset all seem to do
a deep copy.


just deep enough, not more, not less.

To my understanding, that's too deep.
You're copying elements in the collection as well, not just creating a  
copy of the collection with the same elements.
That's what I'd define as a deepCopy, after a copy, I'd expect the  
elements in them to be the same.
Maybe it's just what I've gotten used to in VW, and Squeak does  
something else historically, but mixing and matching which to do based  
on what feels best at any given time can lead to some nasty bugs :)

Thinking for a bit more than 2 minutes (which I should do more often, I know), I guess I agree with copying the links the way you do it.
So just disregard what I wrote.

SparseLargeTables works as I'd expect:
assoc := 7 -> 10.
slt := SparseLargeTable new:5 .
slt at: 5 put: assoc.
slt2 := slt copy.
(slt at: 5) value: 11.
(slt2 at: 5)   7->11

And I guess it doesn't make sense anyhow to mutate elements of a WideCharacterSet :)

Sorry for the noise.

Cheers,
Henry