home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6653 < prev    next >
Encoding:
Text File  |  1992-11-17  |  4.2 KB  |  95 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!clarkson!news
  3. From: kooijman@sun.soe.clarkson.edu (Harry Kooijman,Peyt314a,3808)
  4. Subject: Re: BP/TP OOP is missing something...
  5. Message-ID: <1992Nov17.153804.21729@news.clarkson.edu>
  6. Sender: news@news.clarkson.edu
  7. Nntp-Posting-Host: sun.soe.clarkson.edu
  8. Organization: Clarkson University
  9. References: <KIM.92Nov16125141@kim.Software.Mitel.COM>
  10. Date: Tue, 17 Nov 1992 15:38:04 GMT
  11. Lines: 82
  12.  
  13. From article <KIM.92Nov16125141@kim.Software.Mitel.COM>, by kim@Software.Mitel.COM (Kim Letkeman):
  14. > In article <1992Nov14.140524.720@ualr.edu> choate@acs.harding.edu (Brad S. Choate) writes:
  15. > | When will Borland implement operator overloading for Pascal OOP???
  16. > | They boast that their product is a good way to learn OOP, but
  17. > | provide no way of teaching operator overloading!  I dare say they
  18. > | should not call it "professional" until then.  IMHO, for OOP, stick
  19. > | with C++ until Borland gets their act together (correction...
  20. > | SERIOUS OOP).
  21. > | 
  22. > | Don't get me wrong... I love Pascal, but I hate that it doesn't
  23. > | benefit from all the goodies C++ has gotten over the years!
  24. > Operator overloading is just one tool in the object oriented toolbox.
  25. > One very notable book on the subject "Object Oriented Software
  26. > Construction" by Bertrand Meyer mentions it in passing as: "no more
  27. > than a syntactic facility which relieves programmers from having to
  28. > invent different names for different implementations of an operation
  29. > and, in essence, places the burden on the compiler." See page 39.
  30. > <stuff deleted>
  31. >
  32. > TPW is as professional as any compiler I've ever seen. My guess is
  33. > that it completely smokes all but the very best C++ compilers in
  34. > overall quality and utility (that is, ability to do useful work.)
  35. > I would suggest that you figure out what it is that you really want to
  36. > get out of OOP rather than worrying about this or that missing
  37. > C++ facility in a PASCAL compiler.
  38. > --
  39. > Kim Letkeman    kim@Software.Mitel.COM
  40.  
  41. Why is it that TP with objects does not have the capability to call the
  42. constructors when variables are declared? And when an object goes out of
  43. scope it should be destructed automatically. For example:
  44.  
  45. Function DoSomethingWithD;
  46. Var D:DoubleObject(1.2);
  47. Begin
  48.   ... 
  49.   Do something with D
  50.   ...
  51. End; {and here D gets destructed}
  52.  
  53. This makes using objects not any different than any ordinary variable
  54. type, and a lot more easier to maintain (If I want to delete the use
  55. of the DoubleObject it is sufficient to delete the declaration and
  56. all the references to D, and I don't have to worry about a constructor
  57. and destructor).
  58.  
  59. When you dynamically allocate vectors and matrices this is very useful.
  60. If I forget to call the constructor or destructor I will be in for nasty
  61. debug times.
  62.  
  63. This is why constructors in C++ have the same name as the objects. But
  64. what is more is that they allow for *multiple* constructors (and the
  65. compiler figures out which one to use).
  66.  
  67. It is mentioned that the compiler gets the burden of finding out all
  68. the details which routine to call when operators are overloaded (and
  69. also in other cases, such as the automatic generation of destructors).
  70. Well, to my opinion its better to do so since the compiler does it
  71. faster than we can do. Ultimately we might have toolboxes full of
  72. objects we want add or subtract from eachother. If we want to do so
  73. its much easier to use the + and - then to call specific routines
  74. for each combination. If a certain operation can be interpreted for
  75. more than one (for example matrix * matrix, as Duncan pointed out) 
  76. we have a choice: let the user determine the overloading. He can define
  77. his/her own version and pick the overloading he likes. Or we could pick
  78. the most popular overloading and put a warning in the
  79. manual/documentation!
  80.  
  81. TP with objects is a good product but it's missing some good portions of
  82. the object way of thinking, isn't it? Don't get me wrong: I'll be buying
  83. BP7 as well and probably using its OOP, but totally happy with it, no
  84. I am not. And that's the shame, since I regard Pascal higher than C++.
  85.  
  86. Harry
  87. --
  88. Harry Kooijman: Rigorous dynamic distillation simulation.
  89. Dept. of Chemical Engineering, Clarkson University, Potsdam NY 13699.
  90. kooijman@sun.soe.clarkson.edu
  91.