isKindOf: vs. isClassX methods

Andreas Raab Andreas.Raab at gmx.de
Thu Oct 11 20:04:24 UTC 2001


Ivan,

> I would say 'never say never' (especially not *never*).

I would and I did ;-) However, keep in mind that this was a design
standpoint in an ideal world. And from that standpoint you are *never* (heh,
heh ;-) interested in the type.

Daily practice is something completely different and I have no problem to
accept your example as one of the reasons for using it in the real world ;-)

In the ideal world you should in fact implement #asCharacter.

Cheers,
  - Andreas

-----Original Message-----
From: squeak-dev-admin at lists.squeakfoundation.org
[mailto:squeak-dev-admin at lists.squeakfoundation.org]On Behalf Of Ivan Tomek
Sent: Thursday, October 11, 2001 5:08 AM
To: 'squeak-dev at lists.squeakfoundation.org'
Subject: RE: isKindOf: vs. isClassX methods


I would say 'never say never' (especially not *never*). I think that the
following shows that sometimes I need to know (unnecessarily complex, but a
real example):
In VisualWorks, I want to create a tool for editing hot keys (Ctrl t, ESC b,
etc.), The way this works in VW is that there is a dispatch table with,
essentially, two dictionaries. The first contains Ctrl key combinations and
some special entries, the other ESC combinations.
I would like to display the Ctrl combinations from the first dictionary to
allow the user to manipulate them. So I must extract from this dictionary
those associations that have Character keys. How am I supposed to do that
without either asking the key for its class, isKindOf: isMemberOf:, or
writing an isCharacter?
I will happily change my ways if you show me a better approach.
Ivan
> -----Original Message-----
> From: Andreas Raab [mailto:Andreas.Raab at gmx.de]
> Sent: Thursday, October 11, 2001 12:04 AM
> To: squeak-dev at lists.squeakfoundation.org; 'Eddie Cottongim'
> Subject: RE: isKindOf: vs. isClassX methods
>
> >
> The reason is simply that you are *never* interested in the
> type (e.g.,
> class) of the argument. All you are ever interested in is either its
> interface (e.g., the set of supported protocols) or its role in the
> simulation (which usually comes down to a subset of protocols).
> > >
>
>
>





More information about the Squeak-dev mailing list