home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / object / 4985 < prev    next >
Encoding:
Text File  |  1993-01-21  |  7.2 KB  |  127 lines

  1. Newsgroups: comp.object
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!csus.edu!netcom.com!objsys
  3. From: Bob Hathaway <objsys@netcom.com>
  4. Subject: Re: FAQ  Part 1 (of 2) [ identity and OO paradigm ]
  5. Message-ID: <1993Jan22.004305.16275@netcom.com>
  6. Sender: objsys@netcom.com (Object Systems)
  7. Organization: Object Systems
  8. References: <1993Jan13.061114.18430@netcom.com> <PCG.93Jan19234945@decb.aber.ac.uk>
  9. Date: Fri, 22 Jan 1993 00:43:05 GMT
  10. Lines: 115
  11.  
  12. [Scheduled system shutdowns here will interfere with my posting for a few
  13. days; I was caught in the middle last night...]
  14.  
  15. In article <PCG.93Jan19234945@decb.aber.ac.uk>, pcg@aber.ac.uk (Piercarlo Grandi) writes:
  16. [On values and objects as procedural instances, across > 1 postings]
  17.  
  18. I haven't had time to look into these definitions in depth, but there is a
  19. good point to be made here.  You can view almost anything as anything else
  20. and can contort almost anything into anything else if you try hard enough.
  21. All you need is computational completeness and most programming languages
  22. and models have it.  Just because you can view objects in a strict functional
  23. or procedural way doesn't mean you have too, they're just one alternative
  24. among many.  Now comes the problem of deciding which of these views should
  25. represent the canonical one.
  26.  
  27.   [BTW, another reference on modeling functional languages is "Compiling With
  28.    Continuations", which I plan to read soon.]
  29.  
  30. You give an example of a particular procedural view to objects, although
  31. besides being the most unnatural approach I could think of I see what
  32. appear to be a few flaws (or difficulties) with them already.  One is that
  33. there seems to be only one constructor.  Even C++ offers constructor
  34. overloading, and virtual constructors (with what seems to be both parametric
  35. (one-body) or ad-hoc (many-bodied from derived classes) solutions) are also
  36. neeeded and I don't see how this fits in with the procedural approach.
  37. Even for the simple overloading case, do you propose to duplicate everything
  38. in the body of every constructor?  And some form of inheritance, as found
  39. in natural object-oriented models [read non-procedural as you've proposed],
  40. can handle the overriding case.  Further, the proposed procedural approach
  41. seems to be the furthest from a natural approach I can see.  People think of
  42. objects as having structure and behavior (and more recursively, usually through
  43. inheritance) and this can be directly supported with a natural OO model.
  44. Why contort this into a closure (or record with a function pointer and free
  45. variable list)?  It *may* be possible, but quite unnaturally.
  46.  
  47. A more direct view of objects (at least in a class-based model) is with
  48. structure and behavior, nothing funny.  Nothing stating that an object is
  49. an instance of its constructor.  Smalltalk places the constructor in its
  50. metaclasses and C++ places them in classes as a special member; just one
  51. among many.  Some classes don't even have a constructor (although there
  52. is a default), so to revolve everything around a constructor seems far-
  53. fetched.  Revolving everything around objects (or even classes) in an object-
  54. oriented model is natural, revolving them around procedures is not.  I claim
  55. the procedural-oriented view is most appropriate for procedural languages
  56. and not object-oriented ones.  If anyone is to argue, it should be the
  57. single-hierarchy camp arguing that they are truly object-oriented (by
  58. the literal transliteration), or certainly more oriented towards objects
  59. than the class-based languages.  Your proposed procedural view is just so
  60. much further from the truth.  If you want to implement your objects or even
  61. present your proposed procedural view as an alternative which may provide
  62. insights or usefulness under some circumstances, fine, its just not
  63. appropriate for the canonical object-oriented view.  Actually,
  64. continuations and closures are how many functional languages are
  65. implemented, and may even be the canonical functional view for *those
  66. languages*.  Right thing, wrong paradigm  [New category.  Or perhaps:
  67. Wrong thing, right way?].
  68.  
  69. And for values, one can think of a value as having extension only, as in
  70. relational databases.  Multi-valued dependencies can be said to only work
  71. with values (extension), since any values that match are equal (no
  72. intension).  You can change the meaning of value to be synonymous with
  73. objects (or even model object-oriented models with a canonical functional
  74. model), but I think this is confusing (I think you would use the term
  75. "dangerous" here) because values are equal regardless of identity and
  76. identities are always unique; there is an important distinction here
  77. in the object-oriented model because *both* are present.  It is a grave
  78. programming error to use the wrong kind equality (something which doesn't
  79. occur naturally in the functional model your proposal is natural for), so
  80. the distinction should be *crystal clear* in both construct and definition
  81. in the object-oriented model.  [In other words your view is anachronistic,
  82. or "out of place"]
  83.  
  84. [You were confused on a number of issues I brought up, perhaps I can be
  85. more precise.]
  86.  
  87. I don't claim that object identity is exclusively object-oriented, but
  88. that object-orientation includes object identity.  In the same way I don't
  89. claim object-oriented languages lay claim to descriptor-based approaches
  90. such as pointer semantics, but rather that object-oriented models are
  91. often instances or subclasses of such approaches.  Just because object-
  92. orientation uses object identity (and not vice-versa) doesn't justify using
  93. a value-orientation model for identity and value, this is non-sequitur.
  94. Again, the distinction is so important that it should not be possible to
  95. confuse the two, let alone to consider them synonymous.  This reminds
  96. me of the = and == operator (assignment and equality) problem in C, where
  97. nasty errors can occur because of the orthogonality of the operators.
  98. I would not want to see the same problem arising in OO languages because
  99. objects were considered "values", where value is usually just one case of 
  100. value and identity.  Again, this is not the case in the functional model
  101. where this seems to have come from.
  102.  
  103. >objsys> But then to the programmer, no.  These languages are symbolic,
  104. >objsys> meaning that names are loosely bound to the objects they denote,
  105. >objsys> unlike in conventional languages.
  106. >
  107. >This is one of the most bizarre definitions of "symbolic" that I have
  108. >ever seen; I have usually "symbolic language" refer to languages that
  109.  
  110. I was quoting Coplien, someone you disagree with.  Since there is
  111. dissension over the definition (and you have elaborated on a rather
  112. classical one) of which I was not aware, I'll loose (or maybe change) the
  113. passage from the FAQ.
  114.  
  115. >I also cannot find any way in which names are more loosely bound to the
  116. >objects they denote in Smalltalk or Lisp rather than in conventional
  117. >(algorithmic?) languages (like Eiffel or C++?).
  118.  
  119. Easy, names in Smalltalk can refer to any object (names are loosely bound to
  120. the objects they denote), names in C++ that are not references or pointers
  121. can only denote one object (names are tightly bound to the objects they
  122. denote).  They are not polymorphic in the parametric typing sense and they
  123. will never refer to any other object (intension) during the same lifetime.
  124.  
  125. bob
  126. objsys@netcom.com
  127.