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

  1. Xref: sparky comp.object:3075 comp.lang.eiffel:1028
  2. Newsgroups: comp.object,comp.lang.eiffel
  3. Path: sparky!uunet!psinntp!bony1!richieb
  4. From: richieb@bony1.bony.com (Richard Bielak)
  5. Subject: Re: Class methods (was: Re: How to design a data structure library)
  6. Message-ID: <1992Jul30.123951.20600@bony1.bony.com>
  7. Organization: multi-cellular
  8. References: <graham.712283419@galois> <1992Jul28.201820.27793@bony1.bony.com> <1992Jul29.140357.26748@merlin.hgc.edu>
  9. Date: Thu, 30 Jul 92 12:39:51 GMT
  10. Lines: 50
  11.  
  12. In article <1992Jul29.140357.26748@merlin.hgc.edu> jcm@hgc.edu (James McKim) writes:
  13.  
  14. [...]
  15.  
  16. >
  17. >Yes, it's really the design of the _class_ that originally sparked
  18. >this discussion, not the syntax used. It does seem that designing
  19. >the standard set operations, string operations, etc as creation
  20. >routines is an idea worth pursuing.
  21. >
  22.  
  23. Thanks for adding a voice of sanity into this discussion, before it
  24. degenerates into a flame war :-).
  25.  
  26. My observation was this, although Eiffel does not have "class methods",
  27. as does SmallTalk, you can think of creation routines as class
  28. methods.
  29.  
  30. During Object Expo I attended a talk by Meirl-Page Jones (sp?), in
  31. which he suggested that certain methods *should* be class methods (he
  32. was criticizing classes in Tim Budd's book "The Little SmallTalk").
  33.  
  34. The example he used was "arccos" (ie. inverse cos function). He
  35. argued, that arccos, which returns "anAngle", should be a class method
  36. in class "Angle", rather than an instance method in class "Real".
  37.  
  38. The reason was that he did not want to "encumber" the class "Real"
  39. with class "Angle", as the two are not always used together. Another
  40. words, making "arccos" a class method of "Angle" reduces class
  41. coupling.
  42.  
  43. As another example, consider a routine, "string_to_real", which converts a
  44. string to real number. According to the above argument, this routine
  45. should be a creation routine in REAL. So you'd have code like this:
  46.  
  47.        !!pi.string_to_real ("3.14159");
  48.  
  49. The twist in Eiffel is that you cannot use a creation instruction in
  50. an expression. But that's a different thread...
  51.  
  52.  
  53. ...richie
  54.  
  55.  
  56.  
  57. -- 
  58. * Richie Bielak   (212)-815-3072   | "Your brain is a liquid-cooled parallel  *
  59. * Internet:       richieb@bony.com | super-computer". He pointed to his nose, *
  60. * Bang {uupsi,uunet}!bony1!richieb | "This is the fan."                       *
  61. *    - Strictly my opinions -      |                     - David Chudnovsky - *
  62.