home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / object / 3047 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  2.2 KB

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