home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / std / cplus / 2030 < prev    next >
Encoding:
Text File  |  1993-01-11  |  2.2 KB  |  67 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!stanford.edu!lucid.com!lucid.com!jss
  3. From: jss@lucid.com (Jerry Schwarz)
  4. Subject: Re: Type System
  5. Message-ID: <1993Jan11.233427.1323@lucid.com>
  6. Sender: usenet@lucid.com
  7. Reply-To: jss@lucid.com (Jerry Schwarz)
  8. Organization: Lucid, Inc.
  9. References: <1993Jan4.194318.5340@lucid.com> <C0Iy9o.9x@frumious.uucp> <1993Jan9.001948.28388@lucid.com> <1993Jan10.162757.1097@ucc.su.OZ.AU>
  10. Date: Mon, 11 Jan 93 23:34:27 GMT
  11. Lines: 54
  12.  
  13. In article <1993Jan10.162757.1097@ucc.su.OZ.AU>, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  14.  
  15.  
  16. jss:
  17. |> >You're right.  I knew about that loophole, but forgot about it when
  18. |> >I posted my original item.  If anyone has ideas for a clean way
  19. |> >to close this loophole, I'd be interested to hear them.  
  20. |> 
  21.  
  22. maxtal:
  23. |>     Do we want to close it?
  24.  
  25.  
  26. I do.
  27.  
  28. jss:
  29. |> >
  30. |> >The problem is that the object is only "marked" immutable when the
  31. |> >constructor returns.  The constructor itself is supposed to be free
  32. |> >to modify the object in any way it chooses.
  33.  
  34. maxtal:
  35. |> 
  36. |>     The problem is that the object is *never* marked const.
  37. |> What is made const is the 'reference' or pointer to the object.
  38.  
  39. The original item explained that "marking" wasn't actually caried
  40. out a runtime, but the concept is useful in explaining the intentions
  41. of the type system.
  42.  
  43. To repeat. The desired (by me) property (with slightly more
  44. explicit wording than the original and avoiding the use of "mark's")
  45. is 
  46.  
  47.     If an object is constructed const(immutable), then
  48.     between the time that the constructor (if any) completes
  49.         and the destructor (if any) is called (if ever) the
  50.         type system should guarantee that any expression that refers to 
  51.         this object or a subobject of it will do so via
  52.         const(qualified) type.  
  53.  
  54. I use const(immutable) to indicate a property of an object, and
  55. const(qualified) to indicate a property of a type.
  56.  
  57. This is a desirable property whether or not "const" has any effect
  58. on the primitives, and whether or not the language specifies the
  59. effect of modifying a const(immutable) object.
  60.  
  61. Anything that permits violation of this property is a "loophole".
  62.  
  63. The rest of maxtal's discussion concerned the meaning of "const",
  64. which is a different subject altogether.
  65.  
  66.    -- Jerry Schwarz
  67.