[Pharo-users] Re: Can a class be not equal to itself?

2020-12-31 Thread Benoit St-Jean via Pharo-users
It never occurred to me that it would ever be the case! I've always thought classes were singleton and that SomeClass copy would always return the sole instance of that class! I wonder what are the implications of returning a copy, say, when you add an instVar to the "original" class ?  What

[Pharo-users] Re: Can a class be not equal to itself?

2020-12-31 Thread Richard O'Keefe
What I said just now is true, but it doesn't tell the whole story. It turns out that Squeak, VisualWorks, GNU Smalltalk, and Pharo *deliberately* make aClass copy return a new class with the same superclass and methods (but no subclasses). Dolphin and VisualAge do not. So if you don't want to ma

[Pharo-users] Re: Can a class be not equal to itself?

2020-12-31 Thread Richard O'Keefe
#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

[Pharo-users] Re: Can a class be not equal to itself?

2020-12-31 Thread Konrad Hinsen
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

[Pharo-users] Re: Can a class be not equal to itself?

2020-12-31 Thread Tudor Girba
Hi Konrad, Could it be that you have overridden = on the class side of your class? Otherwise, I do not see how this can happen. Cheers, Tudor > On Dec 31, 2020, at 12:19 PM, Konrad Hinsen > wrote: > > Hi everyone, > > > It's been a while since I have encountered mysterious behavior in Ph

[Pharo-users] Can a class be not equal to itself?

2020-12-31 Thread Konrad Hinsen
Hi everyone, 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