home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.scheme
- Subject: Re: message passing vs. generic functions
- Date: 18 Aug 1992 04:34:46 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 29
- Message-ID: <16pul6INNjfq@early-bird.think.com>
- References: <9208171954.AA05736@cambridge.apple.com>
- NNTP-Posting-Host: gandalf.think.com
-
- In article <9208171954.AA05736@cambridge.apple.com> bill@cambridge.apple.COM ("Bill St. Clair") writes:
- >I find the CLOS generic function approach to be advantageous to the
- >SmallTalk and old Flavors message sending approach for everything but
- >one important case: delegation. Sometimes you want to have an object
- >that special cases a couple of operations, but sends most of them on
- >to another object.
-
- This is true. However, in my experience, automatic delegation like this is
- a dangerous practice, and perhaps it shouldn't be facilitated.
-
- The problem is that new operations may be added without the knowledge of
- the designer of the delegating class. Perhaps this new operation should be
- special cased, but since the class hasn't been updated, it will just pass
- it on naively.
-
- The Symbolics Genera stream system makes extensive use of such classes, and
- it's pretty big mess.
-
- If you have a fixed list of operations on a set of classes (as languages
- like C++ force you to do) then you don't have the problem of unexpected
- operations being added. But then you don't need to implement delegating
- classes by specifying just the special-cases; since the list of normal
- cases is available you can define all the delegating operations explicitly
- (yes, it's tedious, but you can define a macro to automate it).
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-