home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / object / 4531 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  6.2 KB

  1. Path: sparky!uunet!olivea!spool.mu.edu!uwm.edu!linac!uchinews!alex!dave
  2. From: dave@alex.uchicago.edu (Dave Griffith)
  3. Newsgroups: comp.object
  4. Subject: Re: Object hidden state and side effects
  5. Message-ID: <1992Dec15.014420.6604@midway.uchicago.edu>
  6. Date: 15 Dec 92 01:44:20 GMT
  7. References: <1992Dec11.163449.18439@crd.ge.com> <1992Dec13.152136.16852@hasler.ascom.ch> <1992Dec14.112222.13987@kei.is.s.u-tokyo.ac.jp>
  8. Sender: news@uchinews.uchicago.edu (News System)
  9. Organization: University of Chicago
  10. Lines: 106
  11.  
  12. In article <1992Dec14.112222.13987@kei.is.s.u-tokyo.ac.jp> jeff@is.s.u-tokyo.ac.jp writes:
  13. >Jan Steinman (the roving poster) writes:
  14. >
  15. >{ bunch of good stuff deleted }
  16. >
  17. > ! >This is
  18. > ! >why the distinction between values and objects is of enormous
  19. > ! >importance. Software objects are used to model real world objects
  20. > ! >as well as real world values. Modeling objects with other objects
  21. > ! >is far more straight-forward than modeling values with objects.
  22. > ! >The field of numerical analysis is all about the difficulties
  23. > ! >which arise when one is forced to use objects to represent values.
  24. >
  25. >Can you give an example of a real world value which is concretely
  26. >definable and describable in the real world but not in a computer as
  27. >an object (or anything)?
  28. >
  29.  
  30. Arrrghh!!   The question is not "can be modelled", the question is 
  31. "is this form of modelling directly supported (and enforced) by the language".
  32. If this distinction isn't useful, there's no reason to have object oriented
  33. languages at all.  After all, all of the standard object oriented programming
  34. language concepts can be modelled in C using records, pointers, and 
  35. function pointers.  The reason for direct language support for object 
  36. orientation is not that it adds any functionality.  The reason is that it
  37. brings the level of programming closer to the level of human cognition.  
  38. Of course objects can model values.  So can a Turing machine.  The question
  39. is whether it would be valuable to provide direct linguistic support for the
  40. concept value.
  41.  
  42. A more extreme example, and one that I'm working on in my language, is 
  43. inter-object relationships.  There is no _direct_ way in current object-oriented
  44. languages to say "object A stands in relation B to object C".  There are
  45. any number of _indirect_ ways of saying this.  A may be an instance variable
  46. of C, C may be an instance variable of A, the pair (A, C) may be in some
  47. dictionary B, etc. ad infinitum.  Things get even more complex if relations of
  48. arity other than two are allowed, if relations may be many-to-many, if
  49. constraints on relations hold.  All of these may be modelled by current 
  50. languages, but none has direct support for the concept "relation".  As such,
  51. programmers spend time reducing relations to concepts that are modelled
  52. directly by the language.  In addition to being time consuming, this process
  53. of reducing relations is a beautiful place for bugs to manifest.  Whether
  54. relations and values can be added to the object oriented paradigm without
  55. excessive cost is as of yet unknown (I've still got some fairly hairy 
  56. efficiency problems to work out in my compiler.)
  57.  
  58. > ! Huh? Let's replace "object" (a loaded term in this context) with "thing". Let's
  59. > ! further agree that a fraction, or an integer, or the set of values "1", "2",
  60. > ! and "3", or for that matter, the set of values endorsed by the Republican
  61. > ! National Convention, are all "things". None of them *are* the set of binary
  62. > ! patterns that represent them in a computer's memory, but must be represented or
  63. > ! modelled since they are abstract. Some of them are modelled in hordware, some
  64. > ! must be modeled in software.
  65. >
  66. >It seems to me that people are confusing implementation with
  67. >behaviour.  What we are suffering from here is insufficient
  68. >specification.  People are all up in arms because they can't create
  69. >another False.  The problem is that they know there is a False!  A
  70. >properly specified system would simply spec Boolean and leave the rest
  71. >to the implementor.  Ditto for SmallInts.
  72. >
  73. >You just know too much is all.  Hardware, software, OS, VM, mutable,
  74. >immutable?  Who knows?  If you care, you are doing something wrong!
  75. >It's not really your fault either.  The system forces you to know so
  76. >much because there is no decent spec.  Sit back sometime and take a
  77. >good hard look at how much implementation knowledge you are using in
  78. >your systems.  I think you will be surprised.  You can barely help it.
  79. >The methods and vars are just there, tempting you.
  80. >
  81. >As for the difference (if any) between values and objects: value =
  82. >some 'thing' that does not change.  Right?  
  83. >
  84.  
  85. Actually, immutability is only a small part of being a value.  The important
  86. part is lack of identity.  All '3's are the same, regardless of their history.
  87. On the other hand, standard objects are only equal if they are identical.
  88. Immutability is necessary for values, but not sufficient.
  89.  
  90. >Does that mean that the actual bits don't change?  So it is bit
  91. >identity that matters?  If so, your true and mine are different! (we
  92. >have different bits) This is appealing to existentialists for sure but
  93. >would make coding a nightmare.  Who's is right?  Can we decide?  Does
  94. >it matter?  Anyway, what is the "value" of true that pre-existed and
  95. >is being 'modelled' as an object/value in the computer?
  96.  
  97. Whether the actual bits are changable is rather beside to point.  The idea
  98. is that a values essential nature cannot change, whatever that means.  This
  99. is usually easiest if the bits are unchanging, but that is not necessary.
  100.  
  101. >
  102. >If the bits can change and move, then I don't see the diff between
  103. >"value" and "object that does not change".  In short, why can't a
  104. >value be an object?  What does explicitly knowing/using the fact that
  105. >something does not change help us?
  106.  
  107. It _does_ allow a lot of optimization.  There are occasions where copy
  108. semantics are cheaper than reference semantics.  But at a higher level, it 
  109. seems to be necessary to allow safe programming.  We need to know that noone 
  110. can subclass our Integer class so as to allow the old Fortranism of changing 
  111. 3 to 5.
  112.  
  113.  
  114. -- 
  115. Dave Griffith, Information Resources, University of Chicago,
  116. Department of Surgery                       dave@alex.bsd.uchicago.edu
  117. Oh, by the way, I almost forgot.  Godot called.  He said he'd be late.
  118.