patching base classes

Randal L. Schwartz merlyn at stonehenge.com
Wed Nov 17 18:28:51 UTC 1999


>>>>> "jecel" == jecel  <jecel at merlintec.com> writes:

jecel> Do we need to be able to patch base classes? If we want to be able to
jecel> do things like

Object> isHappyObject
jecel>      ^ false

MyClass> isHappyObject
jecel>      ^ true

jecel> then we certainly need this capability. The alternative is the highly
jecel> reflexive

jecel>   anObject isKindOf: MyClass

jecel> My experience is that this second option will always come back to bite
jecel> you later, so I am willing to put up with quite a lot in order to be
jecel> able to code in the first style.

My thought about that is that it's nearly always recommended to just
send the methods you want, and not care what it is.  If you don't know
if the object can handle the messages, you can wrap an exception block
around it (or use #canUnderstand:).  If it's the wrong general type,
but still handles that message, you've got a bad design. :)

Populating Object with "is...." messages seems... just... wrong and
unscalable.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!





More information about the Squeak-dev mailing list