home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / eiffel / 1379 < prev    next >
Encoding:
Internet Message Format  |  1992-12-17  |  1.9 KB

  1. Path: sparky!uunet!plsparc!lef
  2. From: lef@plsparc.UUCP (Lawrence E. Fitzpatrick)
  3. Newsgroups: comp.lang.eiffel
  4. Subject: Re: Semantics of invariants
  5. Message-ID: <392@plsparc.UUCP>
  6. Date: 17 Dec 92 06:28:09 GMT
  7. References: <1992Dec15.213603.16406@bony1.bony.com>
  8. Organization: Personal Library Software, Inc.
  9. Lines: 36
  10.  
  11. In article <1992Dec15.213603.16406@bony1.bony.com> richieb@bony1.bony.com (Richard Bielak) writes:
  12. >Is the invariant supposed to be true *ALL* the time, once the object is
  13. >created? 
  14. >
  15.  
  16. This is rather elegantly defined in the E3 book (p126):
  17.  
  18.     The invariant specifies properties which any instance of the
  19.     class must satisfy at every instant at which the instance is
  20.     observable by clients.
  21.  
  22. A simple reading would suggest that in a single threaded executable,
  23. "observable" might be interpreted to mean "when the thread of control is
  24. with the client."  On the other hand, that approach makes some assumptions
  25. that may be invalidated sooner than one might like.  [Remember the 
  26. Macintosh and "32-bit clean".  Apple did say, don't do this, but there
  27. wasn't any penalty at the time!]  I would prefer a more abstract reading.
  28.  
  29. >If this is so, you can imagine each object having an "invariant-checker"
  30. >running continously on another processor.
  31.  
  32. Interesting idea, depending on what it does.  Seems that the only time
  33. you need to check invariants is when a state changes.  The cost of
  34. checking it (in some cases) far exceeds the cost of signalling a checker
  35. to check it.  (something about dependency lists springs to mind).  But
  36. then there are the synchronization problems -- by the time the checker
  37. determines a violation, the code being checked has executed another 3
  38. million instructions!
  39.  
  40. What percentage of a program's operations are instance state changes?
  41. I bet it's not as high as one might think (for most things).
  42. -- 
  43. Regards, lef
  44.  
  45. Lawrence Fitzpatrick                    Voice:(301)926-1402/Fax:(301)963-9738
  46. Personal Library Software               lef@pls.com
  47.