respondsTo: bug/Hydra
Ralph Johnson
johnson at cs.uiuc.edu
Wed Dec 26 21:21:03 UTC 2007
On Dec 24, 2007 4:24 PM, Chris Cunnington <cunnington at sympatico.ca> wrote:
>> I've never used #respondsTo:.
> I tried this:
>
> Object respondsTo: asMorph
>
> I print it, and get:
>
> Object respondsTo: asMorph false
>
> I thought this was a way of asking any object in the system if it has a
> certain method. How should I use respondsTo:? It's probably a beginner
> question, but, hey. That's me.
It should be "Object respondsTo: #asMorph". But in fact, you can say
"3 respondsTo: #asMorph". The reason that the first works is that
Object is an instance of a subclass of Object. #asMorph is a
message you send to instances, not classes.
-Ralph Johnson
More information about the Squeak-dev
mailing list
|