binary message ==

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

binary message ==

Mark Volkmann
I'm reading "Smalltalk Best Practice Patterns". On page 49 there is  
this example code.

Object>>= anObject
        ^self == anObject

I've never seen == in Smalltalk before. It doesn't seem to be a method  
in Object within Squeak. What's going on here?

---
Mark Volkmann





_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: binary message ==

Matthias Berth-2
Mark,


== tests for object identity. Look for implementors of ==, you find it
in ProtoObject:

== 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


Cheers

Matthias

On Fri, Oct 31, 2008 at 3:05 AM, Mark Volkmann <[hidden email]> wrote:

> I'm reading "Smalltalk Best Practice Patterns". On page 49 there is this
> example code.
>
> Object>>= anObject
>        ^self == anObject
>
> I've never seen == in Smalltalk before. It doesn't seem to be a method in
> Object within Squeak. What's going on here?
>
> ---
> Mark Volkmann
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners