Smalltalk: =, ~=, ==
Equality (Same Value)
= anObject
"Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash."
^self == anObject
~= anObject
"Answer whether the receiver and the argument do not represent the
same object."
^self = anObject == false
If you override =
, you should consider overriding hash
.
Identity (Same Object)
== anObject
"Primitive. Answer whether the receiver and the argument are the same
object (have the same object pointer). Do not redefine the message == in
any other class! Essential. No Lookup. Do not override in any subclass.
See Object documentation whatIsAPrimitive."
<primitive: 110>
self primitiveFailed