"Chris Uppal" <
[hidden email]> wrote in message
news:425e9b69$0$38044$
[hidden email]...
> Steven Kelly wrote:
>
>> Offhand, I can't think of another base class like Symbol, whose potential
>> set of instances is countably infinite, but for which it is guaranteed
>> (other than tricks like the above) that no two instances are = unless
>> they are also ==.
>
> How about Object ? ;-)
Depends what you mean. The OP and I were talking about cases like Symbol, for which:
('ab', 'cd') asSymbol == ('ab', 'cd') asSymbol
whereas for Strings:
('ab', 'cd') ~~ ('ab', 'cd')
Object doesn't preserve uniqueness in this kind of way:
Object new ~~ Object new
which was perhaps the main point.
But of course you're right that I expressed myself unclearly when trying to pin uniqueness down to instances being = and
==, since
Object new ~= Object new
i.e. Object>>= simply uses ==.
But then since this is Smalltalk, I could read your mention of Object as meaning an instance, rather than a class: try
Object class new == Object class new
and you'll see Smalltalk maintaining Object as the singleton instance of the Metaclass instance "Object class".
We can however happily do:
Object class basicNew
to get a new "Object" clone. Unfortunately, having skipped most of the important tying up of loose ends that class
creation normally does, we can't really use it as is to create new instances:
Object class basicNew new "DON'T TRY THIS!!'
will cause the VM to halt because somebody not only didn't understand a message, but didn't even understand
doesNotUnderstand:. And if I don't even understand what it is that I don't understand, I'm pretty stupid!
Steve