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

  1. Xref: sparky comp.object:2989 comp.lang.eiffel:982
  2. Path: sparky!uunet!email!vexpert.dbai.tuwien.ac.at!mst
  3. From: mst@vexpert.dbai.tuwien.ac.at (Markus Stumptner)
  4. Newsgroups: comp.object,comp.lang.eiffel
  5. Subject: Re: Class methods (was: Re: How to design a data structure library)
  6. Message-ID: <5618@vexpert.dbai.tuwien.ac.at>
  7. Date: 24 Jul 92 10:58:49 GMT
  8. References: <1992Jul23.123609.11699@bony1.bony.com>
  9. Organization: DB and ES Subdivision, TU Vienna
  10. Lines: 33
  11.  
  12. From article <1992Jul23.123609.11699@bony1.bony.com>, by richieb@bony1.bony.com (Richard Bielak):
  13. > The interesting question is which class should the routine "union" be
  14. > in?  If a, b, and c are of type SET and "union" is a feature of SET,
  15. > then we have:
  16.  
  17. >       c := a.union(a,b);
  18.  
  19. No.  "Binary operator" means that the receiver is one of the
  20. arguments.  With explicit binary operators (as in C++ or Smalltalk),
  21. you would write (if "+" expresses union)
  22.  
  23. c := a + b
  24.  
  25. That way, "+" is a message declared for sets, and used on sets.  If
  26. you want a named message, you would write
  27.  
  28. c := a.union(b)
  29.  
  30. (Still looks odd, but lacks that redundant third parameter)
  31.  
  32. > In Smalltalk lingo, "union" should be a "class method".  The essence of
  33. > a class method is that it can be invoked when the object of the given
  34. > class does not exist yet.
  35.  
  36. Yes, but you already have two sets, a, and b, either of which you can
  37. send the message to.  Nobody decrees that the receiver of a message
  38. has to be changed by it, therefore returning c is a valid way to do
  39. it.
  40.  
  41. -- 
  42. Markus Stumptner                                mst@vexpert.dbai.tuwien.ac.at
  43. University of Technology Vienna                 vexpert!mst@relay.eu.net
  44. Paniglg. 16, A-1040 Vienna, Austria             ...mcsun!vexpert!mst
  45.