ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  What I Hate About Your Programming Language
Subject:   Java; I want a destructor!
Date:   2003-07-08 07:03:53
From:   anonymous2
Response to: Java; I want a destructor!

Unfortunately the presence of a destructor poses HUGE problems for a garbage-collected language. The garbage collector can't tell when it's safe to collect an object, it can't just drop all the objects when the program ends, etc. I too missed destructors, but try ... finally ... is a good substitute.


Don't use finally() (or python's __del__(), for that matter) as you would a destructor. They may never get called. Also, they pose problems for the garbage collector.


1 to 1 of 1
  1. Java; I want a destructor!
    2006-01-23 23:26:01  bastos [View]

1 to 1 of 1