home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / pascal / 4642 < prev    next >
Encoding:
Internet Message Format  |  1992-07-31  |  1.9 KB

  1. Path: sparky!uunet!dtix!oasys!roth
  2. From: roth@oasys.dt.navy.mil (Pete Roth)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: Constant objects in TP 6.0
  5. Message-ID: <23036@oasys.dt.navy.mil>
  6. Date: 31 Jul 92 12:33:43 GMT
  7. References: <Bs7qyv.KK3@knot.ccs.queensu.ca>
  8. Reply-To: roth@oasys.dt.navy.mil (Pete Roth)
  9. Organization: The David Taylor Model Basin
  10. Lines: 52
  11.  
  12. Newsgroups: comp.lang.pascal
  13. Subject: Re: Constant objects in TP 6.0
  14. Expires: 
  15. References: <Bs7qyv.KK3@knot.ccs.queensu.ca>
  16. Reply-To: roth@oasys.dt.navy.mil (Pete Roth)
  17. Followup-To: 
  18. Organization: The David Taylor Model Basin
  19.  
  20. In comp.lang.pascal, dmurdoch@QueensU.CA (Duncan Murdoch) writes:
  21. >I've just discovered a problem (I'm not sure if I'd call it a bug, but a
  22. >design inconsistency) in Turbo Pascal 6.0's handling of constant objects.
  23.  
  24. [ "bug" description deleted ]
  25.  
  26. >I'd suggest the following alternative syntax for constant objects:
  27. >
  28. >const    { corrected }
  29. >  descend : TDescend.Init(...);
  30. >
  31. >where Init is a constructor.  This would be executed just before the
  32. >initialization section of the unit it occured in.  The constructor could
  33. >set any private fields and generally initialize the object properly.
  34.  
  35. But isn't that what the "unit initialization section" is all about?
  36. Such being the case, the declaration should be
  37.  
  38. UNIT unitname ;
  39. INTERFACE
  40. USES whatever;
  41.  
  42. VAR        { <- much preferred, since the object will most likely change }
  43.    descend : TDescend;
  44.  
  45. IMPLEMENTATION
  46. { etc. }
  47.  
  48. BEGIN
  49.    descend.Init(...) ;
  50. END    .
  51.  
  52. So far the only reason for "constant" objects that I can think of
  53. is the "initialization". What else would you use them for ?
  54.  
  55. regards, pete
  56. - - - - - - - - - - - - - - - - - - - - - - - - - -
  57. Peter N Roth      roth@oasys.dt.navy.mil
  58. "Never argue with someone who buys ink by the barrel." - Daniel Janal.
  59.  
  60. regards, pete
  61. - - - - - - - - - - - - - - - - - - - - - - - - - -
  62. Peter N Roth      roth@oasys.dt.navy.mil
  63. "Never argue with someone who buys ink by the barrel." - Daniel Janal.
  64.