logo       

is* methods: msg#00122

lang.smalltalk.squeak.beginners

Subject: is* methods

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===


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise