| Article: |
What I Hate About Your Programming Language | |
| Subject: | Java; I want a destructor! | |
| Date: | 2003-05-14 09:43:34 | |
| From: | anonymous2 | |
| nuf said. | ||
Showing messages 1 through 4 of 4.
-
Java; I want a destructor!
2003-07-09 03:24:54 anonymous2 [View]
-
Java; I want a destructor!
2003-05-22 17:37:56 anonymous2 [View]
finalize acts like the destructor for Java.
-
Java; I want a destructor!
2003-05-15 18:58:20 anonymous2 [View]
Care to explain why?
-
Java; I want a destructor!
2003-05-15 01:11:36 anonymous2 [View]
That would be completely stupid. The whole point of the destructor is to free heap memory that might have been allocated as part of a data structure. Java has pretty good garbage collection, so this saves you the hassle. I mean, instead of saying delete blah, you can just say blah.finish() if all you are trying to do is complete something before the object is gotten rid of. This sort of thing can be equally easily done in Java without any explicit call that is reserved for freeing memory.



And all the java advocacy crap about how c++ sucks because of memory allocation/deallocation problems...gee, you figure they never heard of putting your "new's" in the constructor and your "delete's" in your destructor -- I guess they haven't, since they don't even have destructors.