canUnderstand: #readFrom:

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

canUnderstand: #readFrom:

mmimica
How come this evaluates to false?
Integer canUnderstand: #readFrom:   --> false
Integer includesSelector: #readFrom:   --> false

However, it does implement the method.
Integer readFrom: '1' readStream.   --> 1


--
Milan Mimica
http://sparklet.sf.net
Reply | Threaded
Open this post in threaded view
|

Re: canUnderstand: #readFrom:

Camillo Bruni-3
You are mixing up class and instance side :)

#canUnderstand: is send to instances
#includesSelector: is sent to classes

(Integer canUnderstand: #readFrom) ==> (Integer class includesSelector: #readFrom:)

On 2013-04-20, at 20:01, Milan Mimica <[hidden email]> wrote:

> How come this evaluates to false?
> Integer canUnderstand: #readFrom:   --> false
> Integer includesSelector: #readFrom:   --> false
>
> However, it does implement the method.
> Integer readFrom: '1' readStream.   --> 1
>
>
> --
> Milan Mimica
> http://sparklet.sf.net


Reply | Threaded
Open this post in threaded view
|

Re: canUnderstand: #readFrom:

camille teruel

> You are mixing up class and instance side :)
>
> #canUnderstand: is send to instances
> #includesSelector: is sent to classes
>
> (Integer canUnderstand: #readFrom) ==> (Integer class includesSelector: #readFrom:)

The instance side equivalent of canUnderstand: is #respondsTo:..
#includesSelector: is class side too but does not look in superclasses.
So you have:

Integer respondsTo: #readFrom:   --> true
Integer class canUnderstand: #readFrom:   --> true
Integer class includesSelector: #readFrom:   --> true


>
> On 2013-04-20, at 20:01, Milan Mimica <[hidden email]> wrote:
>
>> How come this evaluates to false?
>> Integer canUnderstand: #readFrom:   --> false
>> Integer includesSelector: #readFrom:   --> false
>>
>> However, it does implement the method.
>> Integer readFrom: '1' readStream.   --> 1
>>
>>
>> --
>> Milan Mimica
>> http://sparklet.sf.net
>
>