home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
- From: dmurdoch@QueensU.CA (Duncan Murdoch)
- Subject: Re: Constant objects in TP 6.0
- Message-ID: <Bs9CHK.A7q@knot.ccs.queensu.ca>
- Sender: dmurdoch@mast.queensu.ca
- Organization: Queen's University, Kingston, Canada
- References: <Bs7qyv.KK3@knot.ccs.queensu.ca> <23036@oasys.dt.navy.mil>
- Date: Fri, 31 Jul 1992 14:34:32 GMT
- Lines: 40
-
- In article <23036@oasys.dt.navy.mil> roth@oasys.dt.navy.mil (Pete Roth) writes:
- >But isn't that what the "unit initialization section" is all about?
- >Such being the case, the declaration should be
- >
- >UNIT unitname ;
- >INTERFACE
- >USES whatever;
- >
- >VAR { <- much preferred, since the object will most likely change }
- > descend : TDescend;
- >
- >IMPLEMENTATION
- >{ etc. }
- >
- >BEGIN
- > descend.Init(...) ;
- >END .
- >
- >So far the only reason for "constant" objects that I can think of
- >is the "initialization". What else would you use them for ?
-
- No, I don't want to do that. In this case, the unit contains a
- collection of about a dozen sets of coefficients for wavelet transforms.
- The typical caller would only want one set; if they all got initialized
- then they'd all be linked in, regardless of whether they were needed or
- not. Here that means about 4K of wasted space, which isn't a
- huge amount, but in other cases it could mean a lot more.
-
- What I'm aiming for is the ability to have the caller say:
-
- Transform.init(CubicCoeffs);
-
- and have only the cubic coefficients linked in. This is possible if the
- coefficients are defined in separate Const blocks; it would also be
- possible if "CubicCoeffs" were a function instead of a constant. I'll
- probably change to that, since constant objects are getting quite messy
- to deal with.
-
- Duncan Murdoch
- dmurdoch@mast.queensu.ca
-