Posted May 13, 2005 19:15 UTC (Fri) by ncm
In reply to: Lock-in
Parent article: A new Harmony Project
"if I declare a variable private in a class, nothing outside of that class can ever touch it"
... unless you call a library.
"Yes, Java has poorly thought out finalizers."
Worse. To this day nobody has figured out how to specify finalizers so they would not be poorly thought out.
"No, Java can't guarantee against the power plug being pulled, [etc.]"
More to the point, it can't guarantee that logic errors, infinite loops, rooted memory leaks, specification errors, or any of a host of other coding ills will result in a nice exception, any more so than in any other language. C and C++ code running for months on end is the norm.
"... finally is enormously useful, especially in multithreaded code, in that it can provide guarantees that execution will not leave a block without releasing locks,"
"Finally" is a failure precisely because you have no choice but to write it out everywhere there's something to clean up. Each place you write it out is a breeding ground for bugs, because each has to be exercised separately. In C++, destructors clean up, so there no need for "finally". Java lacks destructors, so must make do with "finally".
But we digress...
to post comments)