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

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!world!wmm
  3. From: wmm@world.std.com (William M Miller)
  4. Subject: Re: Alternatives to operator.()
  5. Message-ID: <BruME9.HGJ@world.std.com>
  6. Organization: Software Emancipation Technology, Inc.
  7. References: <1992Jul20.235728.29058@microsoft.com> <Brqq7D.97w@world.std.com> <1992Jul23.024159.18039@microsoft.com>
  8. Date: Thu, 23 Jul 1992 15:44:31 GMT
  9. Lines: 111
  10.  
  11. In article <1992Jul23.024159.18039@microsoft.com>, Jim Adcock writes:
  12. > This would require some understanding and memory retention of my prior
  13. > statements on your part so that I do not have to keep repeatedly answering
  14. > your same mistakes made over and over again.
  15.  
  16. I wonder if it ever occurred to you that the explanation for my
  17. continuing to maintain my objections is that we disagree about the
  18. validity of your arguments, rather than that I have forgotten them or
  19. didn't understand them in the first place?
  20.  
  21.  
  22. > |    i        Fetch the value at the appropriate offset in
  23. > |            f()'s stack frame
  24. > Plain Wrong.  The expression "i" at this location means "reference to the object
  25. > named by i".  Your interpretation is simply in error, as can be seen
  26. > by using your expression "i" as follows:
  27. >     i = 5;
  28.  
  29. But that wasn't the expression I was explaining.  Implicit in my
  30. explanation was an "rvalue" context, which I used because I thought it
  31. would be clearer; in retrospect, I suppose that I should have written
  32. "i;" to avoid any confusion.  However, following your suggestion and
  33. using the more general "reference to..." phraseology does not change
  34. the point I was making -- that the "." simply supplies the
  35. qualification needed to interpret what follows it.
  36.  
  37. Let me recast the table in a way that I hope will avoid any confusion
  38. about lvalues versus rvalues:
  39.  
  40. expr        addressing context    scope
  41. ----        ------------------    -----
  42. i        stack frame of f()    f()
  43.  
  44. ::i        program static        file
  45.         storage
  46.  
  47. x.i        x            class X
  48.  
  49. (*xp).i        object to which xp    class X
  50.         points (indirection)
  51.  
  52. xp->i        object to which xp    class X
  53.         points (indirection)
  54.  
  55. xr.i        object to which xr    class X
  56.         refers (may not be
  57.         an indirection,
  58.         depending on
  59.         implementation)
  60.  
  61. In each case, you look up the name "i" in the implied scope, take the
  62. corresponding offset out of the symbol table, and add it to the base
  63. address implied by the addressing context.  Whether you use the
  64. resulting address in an lvalue or rvalue context is immaterial to the
  65. process.  The role of "." is simply to indicate that the expression
  66. preceding the "." is to be used to determine the addressing context
  67. and scope for the interpretation of the name following.  This is
  68. exactly analogous to what "::" and the absence of qualification do.
  69.  
  70. > |    x.i        Fetch the value at the appropriate offset in
  71. > |            the object "x"
  72. > Plain Wrong.  The expression "x.i" at this location means "reference to the 
  73. > object named by 'x.i'".
  74.  
  75. This isn't detailed enough.  Using your terminology, it should read,
  76. "reference to the object named 'i' within the object 'x'", which is
  77. consistent with my explanation above.
  78.  
  79. > On the contrary, if your phrases above were correct, you would find
  80. > that in all cases an indirection occurs.  Its just that in some built-in
  81. > cases the compiler is smart enough to commonly optimize out the indirection.
  82.  
  83. Just out of curiosity, did you ever program in Bliss?  If I recall
  84. correctly, it has this idea that every name is really just a pointer.
  85.  
  86. > Your statement is false.  One 
  87. > DOES NOT have to provide forwarding functions for those features of the 
  88. > target class one desires to use.  On the Contrary one can CHOOSE to provide
  89. > forwarding functions if desired.
  90.  
  91. If the target class has a member operator and you want to use it via
  92. the smart reference, you MUST provide a forwarding function under your
  93. proposal.  Neither your operator.() nor the conversion function
  94. alleviates this necessity.  If you "CHOOSE" not to provide such
  95. forwarding functions, the desired operations simply won't be available
  96. via the smart reference.  I agree that you have reduced the burden of
  97. writing forwarding functions in your proposal, but you have not
  98. eliminated it.
  99.  
  100. > Your statement is false again.  No circumlocution is necessary because
  101. > of "implied this."  Correct your errors and your objection does not stand.
  102.  
  103. No circumlocution is needed in the smart reference's member functions,
  104. agreed, but that was not the context I was describing.  If there is a
  105. "metaoperation" to be performed on the smart reference itself, the
  106. circumlocation *is* necessary.  Such metaoperations might include
  107. status queries, cache invalidation, network rerouting, etc.
  108.  
  109. > You also need to explore my proposal, so that you can discover that in
  110. > fact the particular disadvantages you mention are not in fact disadvantages
  111. > of my proposal, but rather errors in understanding on your part.
  112.  
  113. I have explored your proposal.  The three disadvantages are still
  114. there.  Refusing to acknowledge them doesn't make them go away.  There
  115. is room for discussion about the degree to which they are significant,
  116. but denial doesn't move that discussion forward very much.
  117.  
  118. -- William M. Miller, wmm@world.std.com
  119.