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

tim Rowledge tim at rowledge.org
Sun Sep 1 02:39:43 UTC 2013


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.




More information about the Squeak-dev mailing list