home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.object:3047 comp.lang.eiffel:1007
- Newsgroups: comp.object,comp.lang.eiffel
- Path: sparky!uunet!s5!is1.is.morgan.com!is0.is.morgan.com!steinman
- From: steinman@is.morgan.com (Jan Steinman)
- Subject: Re: Class methods (was: Re: How to design a data structure library)
- In-Reply-To: richieb@bony1.bony.com's message of 28 Jul 92 15:01:14 GMT
- Message-ID: <STEINMAN.92Jul28184519@hawk.is.morgan.com>
- Sender: news@is.morgan.com
- Nntp-Posting-Host: hawk
- Organization: Morgan Stanley & Company
- References: <GEOFF.92Jul27100601@wodehouse.flash.bellcore.com>
- <5631@vexpert.dbai.tuwien.ac.at>
- <1992Jul28.150114.25065@bony1.bony.com>
- Date: Tue, 28 Jul 1992 23:45:19 GMT
- Lines: 34
-
- In article <1992Jul28.150114.25065@bony1.bony.com> richieb@bony1.bony.com (Richard Bielak) writes:
-
- Perhaps "+" _should_ be a class message. Again, "+" is not a
- "query" or a "command". For numbers, "absolute_value" or "sign" are
- examples of queries, and "increment" is a command.
-
- What is "+"? You could say it's a query, as it doesn't change the
- object, which asks "what is the sum of self and the argument".
-
- But in math, a "+" is an operation on _integers_ (i.e. a class
- method) which given two integers, produces another one.
-
- I think the hang-up on queries or commands is getting in the way here,
- as is the class-object distinction. Objects are created continuously
- and rapidly; many messages need to return newly created objects, and
- if you insist that only classes can return new objecs, you'll get in
- trouble quick!
-
- If you must think in terms of categories of messages, how about adding
- a third: "collaboration". aMan and aWoman collaborate to create aChild
- -- they don't ask either Manness or Womanness to do it for them!
- Likewise, "3" and "4" can collaborate to create "7", "1", or anything
- else that is legal among consenting adults.
-
- Likewise with Sets. It obviously takes both of them to produce a
- union; a Set class is merely an uninterested third party in their
- happy union!
-
- In Smalltalk, collaboration is used frequently in double-dispatching.
- I think Ingals had a nice paper on it.
- --
- : : Jan Steinman steinman@is.morgan.com Bytesmiths : :
- : : 2002 Parkside Court West Linn, OR 97068-2767 : :
- : : 503/657-7703 212/956-8722 : :
-