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

  1. Xref: sparky comp.object:3020 comp.lang.eiffel:988
  2. Newsgroups: comp.object,comp.lang.eiffel
  3. Path: sparky!uunet!walter!geoff
  4. From: geoff@flash.bellcore.com (Geoffrey Clemm)
  5. Subject: Re: Class methods (was: Re: How to design a data structure library)
  6. In-Reply-To: mst@vexpert.dbai.tuwien.ac.at's message of 24 Jul 92 10:58:49 GMT
  7. Message-ID: <GEOFF.92Jul27100601@wodehouse.flash.bellcore.com>
  8. Sender: news@walter.bellcore.com
  9. Nntp-Posting-Host: wodehouse
  10. Organization: Bellcore
  11. References: <1992Jul23.123609.11699@bony1.bony.com> <5618@vexpert.dbai.tuwien.ac.at>
  12. Date: 27 Jul 92 10:06:01
  13. Lines: 43
  14.  
  15. In article <5618@vexpert.dbai.tuwien.ac.at> mst@vexpert.dbai.tuwien.ac.at (Markus Stumptner) writes:
  16. > With explicit binary operators (as in C++ or Smalltalk),
  17. > you would write (if "+" expresses union)
  18.  
  19. > c := a + b
  20.  
  21. > That way, "+" is a message declared for sets, and used on sets.  If
  22. > you want a named message, you would write
  23.  
  24. > c := a.union(b)
  25.  
  26. > (Still looks odd, but lacks that redundant third parameter)
  27.  
  28. > > In Smalltalk lingo, "union" should be a "class method".  The essence of
  29. > > a class method is that it can be invoked when the object of the given
  30. > > class does not exist yet.
  31.  
  32. > Yes, but you already have two sets, a, and b, either of which you can
  33. > send the message to.  Nobody decrees that the receiver of a message
  34. > has to be changed by it, therefore returning c is a valid way to do
  35. > it.
  36.  
  37. I believe you missed the central point of Richie's article, namely that
  38. Eiffel 3.0 has a clean way of handling this situation, to quote:
  39.  
  40. In article <1992Jul23.123609.11699@bony1.bony.com> richieb@bony1.bony.com (Richard Bielak) writes:
  41.  
  42. > Given this, the above call to "union" would be written like this
  43. > (using Eiffel 3 syntax):
  44.  
  45. >     !!c.union (a,b);
  46.  
  47. > Which I think is better. 
  48.  
  49. With which I completely agree.  This avoids the unpleasant assymetry
  50. of c:=a.union(b).
  51.  
  52. Cheers,
  53.  
  54. Geoff
  55.  
  56. --
  57. geoff@bellcore.com
  58.