home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19728 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  5.0 KB

  1. Xref: sparky comp.lang.c++:19728 comp.object:4987
  2. Newsgroups: comp.lang.c++,comp.object
  3. Path: sparky!uunet!usc!rpi!uwm.edu!linac!uchinews!alex!dave
  4. From: dave@alex.uchicago.edu (Dave Griffith)
  5. Subject: Re: Pros and cons of C++
  6. Message-ID: <1993Jan21.231618.8962@midway.uchicago.edu>
  7. Sender: news@uchinews.uchicago.edu (News System)
  8. Organization: University of Chicago
  9. References: <1993Jan20.232007.29047@neptune.inf.ethz.ch> <1993Jan21.144542.20593@midway.uchicago.edu> <1993Jan21.200817.10226@neptune.inf.ethz.ch>
  10. Date: Thu, 21 Jan 1993 23:16:18 GMT
  11. Lines: 95
  12.  
  13. In article <1993Jan21.200817.10226@neptune.inf.ethz.ch> santas@inf.ethz.ch (Philip Santas) writes:
  14. >
  15. >In article <1993Jan21.144542.20593@midway.uchicago.edu> dave@alex.uchicago.edu (Dave Griffith) writes:
  16. >> santas@inf.ethz.ch (Philip Santas) writes:
  17. >>
  18. >>Argggh, you force me to come back.  The reason it complicates the formal
  19. >>is not that finding the correct bindings is difficult.  The reason that the
  20. >>formal semantics gets complicated is that previously primitive operations
  21. >>may now exhibit non-termination, abnormal return (setjmp or exceptions),
  22. >>modification of global state or stack, implementation-defined behavior,
  23. >>and ghod knows what else.  
  24. >
  25. >Since in C++ you _cannot_ redefine primitive operations with means
  26. >other than macros (and we were not talking about macros), nothing of the
  27. >problems you mention occur. Notice that equalty on integers, for instance,
  28. >cannot be redefined. The reason it cannot, is that int is not a class;
  29. >you can redefine operators only in classes.
  30. >
  31.  
  32. You have asserted that this is not a problem in languages in which primitives
  33. are classes (Smalltalk, Axiom/Scratchpad).  The problems I discussed are
  34. still present in those systems.  C++'s (IMHO) inconsistent design decision to 
  35. treat primitives as non-class types is hardly a point in it's favor.
  36.  
  37. >I understand that you want to substitute a symbol, say "=", with one value
  38. >all over your formalism, but the fact that you cannot do it, does not mean
  39. >that the language is complex, it means that you have to find another way
  40. >to deal with it. Furthermore, people feel comfortable with operators
  41. >like "+" and "*" which have been primitevely overloaded for reals, integers, 
  42. >etc. There is no reason why not to treat "=" in the same way.
  43. >
  44.  
  45. If you've still got the archive, the value/object discussion of a month 
  46. ago makes my position pretty clear on this subject, in probably overly
  47. deep detail. 
  48.  
  49. >Notice also that we deal with a non-trivial type system (I do not discuss
  50. >how it is implemented, this is another story)
  51. >Denotational semantics have elegant approaches on simple type systems,
  52. >but for more complicated ones they are confusing. Notice that by
  53. >assuming _traditional_ subclassing, you have a form of overloading "=",
  54. >since the objects have (od do not have) to coerce to the superclasses
  55. >in many cases. This overloading occurs with every link you add.
  56. >
  57.  
  58. Nonsense.  In traditional subclassing, there is no concept of coercing to
  59. the superclass at all.  Coercions, if they occur, are utterly orthogonal to
  60. the subclassing heirarchy.  C++ implements this _very_ poorly (truncating
  61. objects if passed by value!) but calling this traditional inheritance is
  62. just wrong.
  63.  
  64. >> If you don't think that these complicate
  65. >>formal semantics then you've never had to write one. 
  66. >
  67. >As I said, they do not complicate it more, than normal, standard inheritance
  68. >does. If you think that the DSD of C++ is more complex that ST-80,
  69. >or Eiffel, then make the comparison, and show us the results.
  70. >Then you have to show that the increased complexity derives from
  71. >overloading operators like +, =, etc. BY HAND.
  72.  
  73. As much as I would love to spend the next decade (a conservative estimate)
  74. working on a formal definition of C++, I'm forced to pass.  Even suggesting 
  75. that someone might need to put in that huge amount of work to prove this 
  76. utterly trivial point weakens your case.
  77.  
  78. >
  79. >> Not only does the formal
  80. >>semantics need to worry about these new possibilities, so does every
  81. >>programmer (neophyte and expert).  In this case, adding functions is different
  82. >>than overriding primitives, because primitives come with garauntees of
  83. >>behaviour which are not there with user defined functions.
  84. >
  85. >Yes. Primitives on _primitive types_ come with garantees.
  86. >Do not forget this.
  87.  
  88. Only because C++ is inconsistent in it's treatment of primitive types!
  89.  
  90. >
  91. >I do not see _what_ you can garantee on user defined data types,
  92. >Have you ever tried to garantee equality on sets, by means of 
  93. >primitive definition of equality? Or equality on functions?
  94. >
  95.  
  96. For sets, certainly.  With Eiffel class invariants. Admittedly it isn't compile 
  97. time checkable (that would require a solution to the halting problem), but
  98. the garauntee is nonetheless expressible. 
  99.  
  100. What I would really want to know is why we're both wasting this much time 
  101. on such a trivial point.
  102.  
  103. -- 
  104. Dave Griffith, Information Resources, University of Chicago,
  105. Department of Surgery                       dave@alex.bsd.uchicago.edu
  106. When buying and selling are controlled by legislation, the first things bought
  107. and sold are legislators.
  108.