[squeak-dev] USe of isKindOf: is a crime against humanity

Casey Ransberger casey.obrien.r at gmail.com
Sun Sep 1 03:37:30 UTC 2013


Only tangentially related but I can't resist. Here's my least-favorite
hack... pure evil. What was that thing uncle Ben said about power?

someObject perform: ('foo' , 'Bar') asSymbol. "There are no senders of
#fooBar! Oh wait..."


On Sat, Aug 31, 2013 at 8:30 PM, Casey Ransberger
<casey.obrien.r at gmail.com>wrote:

> Totally. Also, one might argue that switching on type isn't terribly
> object-oriented. Or rather, it sort of re-implements dispatch. Sometimes
> it's hard to avoid, but some hard things are worth doing. Of course I'm a
> big fat hypocrite once in a long while (DNU hacks, #isKindOf:, etc.)
>
> #respondsTo: is nicer in some spots. Protocol isn't class. Etc.
>
> +1
>
>
> On Sat, Aug 31, 2013 at 7:39 PM, tim Rowledge <tim at rowledge.org> wrote:
>
>> There are 623 senders of isKindOf: in the 4.5 image I'm using right now -
>> which may be more than the general because I have some extra stuff loaded -
>> and I'd bet that there are no more than a dozen places where it is actually
>> a sensible way of doing what is needed.
>>
>> It's slow - it scans up a class tree.
>> It's ugly.
>> It isn't actually testing what a lot of people seem to think - if you
>> want to find out is some object can handle a certain capability try
>> actually asking with something like  #isAGraphicThing rather than
>> (isKindOf: Morph) or:[ foo isKindOf: DisplayObject] blahblahblah.
>>
>> We can do better.
>>
>> tim
>> --
>> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>> Useful random insult:- Paralyzed from the neck up.
>>
>>
>>
>>
>
>
> --
> Casey Ransberger
>



-- 
Casey Ransberger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130831/2bf5ccfd/attachment.htm


More information about the Squeak-dev mailing list