Article View: comp.std.c++
Article #74Re: Alternatives to operator.()
From: Fergus James HENDERSON
Date: Thu, 23 Jul 1992 18:34
Date: Thu, 23 Jul 1992 18:34
43 lines
2261 bytes
2261 bytes
wmm@world.std.com (William M Miller) writes: >In article <1992Jul23.024159.18039@microsoft.com>, Jim Adcock writes: >> No circumlocution is necessary because of "implied this." > >No circumlocution is needed in the smart reference's member functions, >agreed, but that was not the context I was describing. If there is a >"metaoperation" to be performed on the smart reference itself, the >circumlocation *is* necessary. Such metaoperations might include >status queries, cache invalidation, network rerouting, etc. True. However in general the idea with smart references is that they be "just like" real references, so that most of the code doesn't need to tell the difference. One would expect therefore that most of the code would not need to access such meta-operations. There are also several ways of hiding away the circumlocution, if it still bothers you (variations on the usual macro-hackery). One way would be to use a functional syntax for the meta-operations: SmartRef r; invalidate_cache(r); query_status(r); Alternatively you could define one function on smartrefs that returns a smartref-controller: Smartref r; control(r).invalidate_cache(); control(r).query_status(); This looks like a nice way of doing it to me, since it visually flags the use of meta-operations, while still allowing the normal "." syntax. [I've left the implementation details unstated; perhaps someone with a little time to spare might like to fill them in.] -- Fergus Henderson fjh@munta.cs.mu.OZ.AU This .signature VIRUS is a self-referential statement that is true - but you will only be able to consistently believe it if you copy it to your own .signature file!
Technical Details
Message-ID:
<9220604.6372@mulga.cs.mu.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjhReferences:
<1992Jul20.235728.29058@microsoft.com> <Brqq7D.97w@world.std.com> <1992Jul23.024159.18039@microsoft.com> <BruME9.HGJ@world.std.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) Subject: Re: Alternatives to operator.() Message-ID: <9220604.6372@mulga.cs.mu.OZ.AU> Sender: news@cs.mu.OZ.AU Organization: Computer Science, University of Melbourne, Australia References: <1992Jul20.235728.29058@microsoft.com> <Brqq7D.97w@world.std.com> <1992Jul23.024159.18039@microsoft.com> <BruME9.HGJ@world.std.com> Date: Thu, 23 Jul 1992 18:34:54 GMT Lines: 43