That does not answer my problem.
2 both is: #fraction (with 1 denominator) and is: #integer so how do you
implement?
or: [super is: #number] ?


2013/6/25 Igor Stasenko <siguc...@gmail.com>

> On 25 June 2013 12:47, Nicolas Cellier
> <nicolas.cellier.aka.n...@gmail.com> wrote:
> > But in some cases, you will end up with an object that is more than one
> > thing:
> > - a Number
> > - an Integer
> > - a Fraction
> > For example 0 shall answer yes to these 3.
> > So ^foo == #specialName just does not work, or you end up with caseOf:
> >
>
> err, why?
>
> if you define it like:
>
> Number>>is: symbol
>   ^ symbol == #number
>
>
> 0 is: #number => true
> 0.0 is: #number => true
> 0/1  is: #number => true
> ?
>
> It is actually up to implementor how to his own classes should process
> #is: message.
> The only invariant (which imo best one), that Object should always
> answer false to #is: message no matter what parameter you passed, to
> avoid any ambiguous cases and keep things simple and easy to remember.
> That means, that unless you override this method in own class, its
> instances will always answer false to #is: message.
> And when you override it, you are free to define it the way you like...
>
> MyClass>>is: foo
>   ^ foo class == self class
> or
> MyClass>>is: foo
>   ^ foo class name == self class name
> or
>
> MyClass>>is: foo
>   ^ foo isKindOf: MyClass
>
> (no limits to imagination :)
>
> --
> Best regards,
> Igor Stasenko.
>
>

Reply via email to