home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / object / 3205 < prev    next >
Encoding:
Text File  |  1992-08-14  |  1.9 KB  |  45 lines

  1. Newsgroups: comp.object
  2. Path: sparky!uunet!cs.utexas.edu!convex!news.utdallas.edu!corpgate!bnrgate!nrcnet0!cunews!cunews!knight
  3. From: knight@mrco.carleton.ca (Alan Knight)
  4. Subject: Re: How FUNCTION be OPJECTS?
  5. Message-ID: <knight.713802652@cunews>
  6. Sender: news@cunews.carleton.ca (News Administrator)
  7. Reply-To: knight@mrco.carleton.ca (Alan Knight)
  8. Organization: Carleton University
  9. References: <1992Aug10.224351.17853@lut.ac.uk>     <1992Aug11.092606.30171@m.cs.uiuc.edu> <STEVE.92Aug11165341@diana.Advansoft.COM>
  10. Date: Fri, 14 Aug 1992 14:30:52 GMT
  11. Lines: 32
  12.  
  13. In <STEVE.92Aug11165341@diana.Advansoft.COM> steve@Advansoft.COM (Steve Savitzky) writes:
  14.  
  15. >The time when you *really* need functions to be objects is when you
  16. >need to pass a function as an operand (e.g. to a sort method) or keep
  17. >it as part of some object's state (e.g. a graph widget).
  18.  
  19. >Languages like Smalltalk make life difficult by having two
  20. >incompatible representations for functions used in this way: as a
  21. >block or as the name of a method.
  22.  
  23. In Smalltalk the normal way of doing this is to pass blocks, method
  24. names are uncommon.
  25.  
  26. There is an advantage to method names. The method "perform:" can be
  27. considerably faster than "value". This is certainly true in
  28. Smalltalk/V. I'm not sure if the optimization of simple blocks in
  29. ObjectWorks succeeds in getting rid of this overhead or not.  I
  30. implemented something that avoided the incompatability by defining
  31. additional methods so that the two could be used interchangeably. I
  32. actually used
  33.  
  34.    blockOrString applyTo: obj1 and: obj2 ...
  35.  
  36. although there's no reason you couldn't have implemented value,
  37. value:value: etc. for strings or perform:, perform:with: etc for
  38. Strings.
  39.  
  40. -- 
  41.  Alan Knight  knight@mrco.carleton.ca  +1 613 788 2600x5783   Join
  42.  Dept. of Mechanical and Aerospace Engineering                the
  43.  Carleton University, Ottawa, Ontario, Canada, K1S 5B6        LPF
  44.  
  45.