#deepCopy is one of those things that is best avoided,
because it violates the key principle of OOP that an
object is in charge of its own data and behaviour.
It can not so much break invariants as crush them and
bury them in an unmarked grave, just like #shallowCopy.



On Fri, 1 Jan 2021 at 03:25, Konrad Hinsen <konrad.hin...@fastmail.net>
wrote:

> On 31/12/2020 12:19, Konrad Hinsen wrote:
>
> > It's been a while since I have encountered mysterious behavior in
> > Pharo, but today it happened. I set up a dictionary with classes as
> > keys, and got "Key not found" errors for keys that were definitely in
> > my dictionary. A quick debugging session showed the underlying issue:
> > I had two references to a class which look the same when inspected,
> > but turn out to be not identical (==) and thus not equal (=). How can
> > this happen?
>
>
> Update, after a few more debugging sessions: my dictionary is the result
> of a deepCopy operation, meaning the class has been copied. And the copy
> of a class is indeed a distinct but otherwise indistinguishable class.
> 'Object copy = Object' is 'false'.
>
>
> Konrad.
>

Reply via email to