home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / std / cplus / 928 < prev    next >
Encoding:
Text File  |  1992-07-23  |  2.2 KB  |  55 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
  3. From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
  4. Subject: Re: Alternatives to operator.()
  5. Message-ID: <9220604.6372@mulga.cs.mu.OZ.AU>
  6. Sender: news@cs.mu.OZ.AU
  7. Organization: Computer Science, University of Melbourne, Australia
  8. References: <1992Jul20.235728.29058@microsoft.com> <Brqq7D.97w@world.std.com> <1992Jul23.024159.18039@microsoft.com> <BruME9.HGJ@world.std.com>
  9. Date: Thu, 23 Jul 1992 18:34:54 GMT
  10. Lines: 43
  11.  
  12. wmm@world.std.com (William M Miller) writes:
  13.  
  14. >In article <1992Jul23.024159.18039@microsoft.com>, Jim Adcock writes:
  15. >> No circumlocution is necessary because of "implied this."
  16. >
  17. >No circumlocution is needed in the smart reference's member functions,
  18. >agreed, but that was not the context I was describing.  If there is a
  19. >"metaoperation" to be performed on the smart reference itself, the
  20. >circumlocation *is* necessary.  Such metaoperations might include
  21. >status queries, cache invalidation, network rerouting, etc.
  22.  
  23. True.
  24.  
  25. However in general the idea with smart references is that they be "just like"
  26. real references, so that most of the code doesn't need to tell the difference.
  27. One would expect therefore that most of the code would not need to access
  28. such meta-operations.
  29.  
  30. There are also several ways of hiding away the circumlocution, if it still
  31. bothers you (variations on the usual macro-hackery). One way would be to
  32. use a functional syntax for the meta-operations:
  33.  
  34.     SmartRef r;
  35.     invalidate_cache(r);
  36.     query_status(r);
  37.  
  38. Alternatively you could define one function on smartrefs that returns
  39. a smartref-controller:
  40.  
  41.     Smartref r;
  42.     control(r).invalidate_cache();
  43.     control(r).query_status();
  44.  
  45. This looks like a nice way of doing it to me, since it visually flags
  46. the use of meta-operations, while still allowing the normal "." syntax.
  47.  
  48. [I've left the implementation details unstated; perhaps someone with a little
  49. time to spare might like to fill them in.]
  50. -- 
  51. Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
  52. This .signature VIRUS is a self-referential statement that is true - but 
  53. you will only be able to consistently believe it if you copy it to your own
  54. .signature file!
  55.