home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / pascal / 4645 < prev    next >
Encoding:
Text File  |  1992-07-31  |  1.8 KB  |  52 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
  3. From: dmurdoch@QueensU.CA (Duncan Murdoch)
  4. Subject: Re: Constant objects in TP 6.0
  5. Message-ID: <Bs9CHK.A7q@knot.ccs.queensu.ca>
  6. Sender: dmurdoch@mast.queensu.ca
  7. Organization: Queen's University, Kingston, Canada
  8. References: <Bs7qyv.KK3@knot.ccs.queensu.ca> <23036@oasys.dt.navy.mil>
  9. Date: Fri, 31 Jul 1992 14:34:32 GMT
  10. Lines: 40
  11.  
  12. In article <23036@oasys.dt.navy.mil> roth@oasys.dt.navy.mil (Pete Roth) writes:
  13. >But isn't that what the "unit initialization section" is all about?
  14. >Such being the case, the declaration should be
  15. >
  16. >UNIT unitname ;
  17. >INTERFACE
  18. >USES whatever;
  19. >
  20. >VAR        { <- much preferred, since the object will most likely change }
  21. >   descend : TDescend;
  22. >
  23. >IMPLEMENTATION
  24. >{ etc. }
  25. >
  26. >BEGIN
  27. >   descend.Init(...) ;
  28. >END    .
  29. >
  30. >So far the only reason for "constant" objects that I can think of
  31. >is the "initialization". What else would you use them for ?
  32.  
  33. No, I don't want to do that.  In this case, the unit contains a
  34. collection of about a dozen sets of coefficients for wavelet transforms.
  35. The typical caller would only want one set; if they all got initialized
  36. then they'd all be linked in, regardless of whether they were needed or
  37. not.  Here that means about 4K of wasted space, which isn't a
  38. huge amount, but in other cases it could mean a lot more.
  39.  
  40. What I'm aiming for is the ability to have the caller say:
  41.  
  42.   Transform.init(CubicCoeffs);
  43.  
  44. and have only the cubic coefficients linked in.  This is possible if the
  45. coefficients are defined in separate Const blocks; it would also be
  46. possible if "CubicCoeffs" were a function instead of a constant.  I'll 
  47. probably change to that, since constant objects are getting quite messy 
  48. to deal with.
  49.  
  50. Duncan Murdoch
  51. dmurdoch@mast.queensu.ca
  52.