home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6685 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  2.0 KB

  1. Xref: sparky comp.lang.pascal:6685 comp.object:4257
  2. Newsgroups: comp.lang.pascal,comp.object
  3. Path: sparky!uunet!clarkson!news
  4. From: kooijman@sun.soe.clarkson.edu (Harry Kooijman,Peyt314a,3808)
  5. Subject: Re: BP/TP OOP is missing something...
  6. Message-ID: <1992Nov18.161317.5225@news.clarkson.edu>
  7. Sender: news@news.clarkson.edu
  8. Nntp-Posting-Host: sun.soe.clarkson.edu
  9. Organization: Clarkson University
  10. References: <dmurdoch.284.722095796@mast.queensu.ca>
  11. Date: Wed, 18 Nov 1992 16:13:17 GMT
  12. Lines: 30
  13.  
  14. From article <dmurdoch.284.722095796@mast.queensu.ca>, by dmurdoch@mast.queensu.ca (Duncan Murdoch):
  15. > In article <1992Nov18.104536.9985@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes:
  16. >>In any flavour of OO Pascal without such parameters, the constructor
  17. >>of a general matrix class (i.e. without fixed dimensions) would most
  18. >>naturally create only a "handle" for an actual matrix.
  19. > This doesn't seem like a very clean solution.  Does it mean that I'd have 
  20. > an array without a size after the automatic initialization?  Then I'd have 
  21. > to send a size message to it before I could use it?  It sounds to me as 
  22. > though the size message is the real initialization; automatic initialization 
  23. > doesn't work here, because it doesn't produce a usable object (i.e. 
  24. > establish the invariants of the class, as you said).
  25.  
  26. The language does not force you to have an "empty" constructor and that
  27. the actual initialization (here for the matrix size) is done later, but
  28. allows you to do both. Now that's freedom of choice! Actually it allows
  29. classes/objects that size themselves according to the (local) needs. So
  30. you can say I want a vector, use it for an array of size x, then
  31. increase its size to y, use it, then decrease its size to z and use it.
  32. When the vector goes out of scope, it knows what it last size was and
  33. frees the memory it was occupying at destruction.
  34.  
  35.  
  36.  
  37. --
  38. Harry Kooijman: Rigorous dynamic distillation simulation.
  39. Dept. of Chemical Engineering, Clarkson University, Potsdam NY 13699.
  40. kooijman@sun.soe.clarkson.edu
  41.