[Newbies] is* methods

Blake blake at loadedshelf.com
Fri Jan 25 09:40:25 UTC 2008


Hello, all:

	While wandering through the (hefty) base Object class, I came across the  
is* methods, which I had of course used many times.

	They're very convenient.

	But are they, well, stupid? Something like 40 methods that all return  
false and are overridden by one class somewhere in the hierarchy? Wouldn't  
their purpose be better served by a single method, like:

is: Class
    ^(self class) inheritsFrom: Class

which would never have to be overridden? Obviously there are some is*  
methods that server a larger purpose but isn't more...polymorphic...to say

is: String
is: Morph
is: SomeNewClass

rather than

isString
isMorph

and then add "isSomeNewClass" when you need it?

	===Blake===


More information about the Beginners mailing list