home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.tek.com!vice!bobbe
- From: bobbe@vice.ICO.TEK.COM (Robert Beauchaine)
- Newsgroups: comp.lang.pascal
- Subject: Re: BP/TP OOP is missing something...
- Message-ID: <10773@vice.ICO.TEK.COM>
- Date: 17 Nov 92 21:08:27 GMT
- References: <KIM.92Nov16125141@kim.Software.Mitel.COM> <1992Nov17.153804.21729@news.clarkson.edu> <dmurdoch.282.722020256@mast.queensu.ca>
- Organization: Tektronix, Inc., Beaverton, OR.
- Lines: 63
-
-
- Well Duncan, it appears that the only thing about TP we agree on
- is that we like using it...
-
- In article <dmurdoch.282.722020256@mast.queensu.ca> dmurdoch@mast.queensu.ca (Duncan Murdoch) writes:
- >
- >This is there in TP, to a very limited extent: you can have an initialized
- >variable which is an object, and you needn't call the constructor. It's
- >initialized at program load time, not each time the variable comes into
- >scope. The destructor is never called.
-
- This is a poor solution, since that variable now exists for
- the entire lifetime of the program, taking up precious data space
- for no reason during the 95+ percent of the time you're not using
- it.
-
- >It's pretty unlikely that Borland would make such a fundamental change
- >that doesn't add any power to the language. Your code fragment is exactly
- >equivalent to
- >
- > var D:DoubleObject;
- > begin
- > D.init(1.2);
- > ...
- > D.done;
- > end;
- >
- >Since what you want to do is already possible with nothing more than a
- >couple of extra lines of code, why make a big change to the language?
- >
-
- This whole topic falls under the scope of garbage
- collection, which is considered by many programmers an extremely
- important part of a language. And pascal already does it all the
- time anyway. What happens to the local variables allocated on the
- stack when a function begins or ends? They are created/destroyed
- by the compiler, which knows knows exactly how to perform these
- tasks. The only difference between
- objects and the predefined data types is that *you* have to tell
- the compiler exactly how to build or get rid of the objects. You
- should not have to tell the compiler _when_ to do so. It seems to
- me the current object construction/destruction methodology is the
- departure from the norm.
-
- This is exactly why I like the C++ approach. With automated
- construction/destruction, operator overloading, etc, objects are
- much more seamlessly integrated into an application as extensions
- of the basic data types. Once the class is properly defined, the
- programmer never has to consider the objects as anything except
- predefined atomic stuctures again.
-
- /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
-
- Bob Beauchaine bobb@vice.ICO.TEK.COM
-
- "Look, I tried the cat experiment. On the third trial, the cat was
- dead. On each of the subsequent 413 trials, it remained dead. Am I
- doing something wrong?"
- James Nicoll
-
- Q. How many Heisenbergs does it take to screw in a light bulb?
- A. If you know the number, you don't know where the light bulb is!
-
-