PrimaryKey wrote:
> There seems to be some form of destructor (called finalizers) in the
> ObjectSpace module, but it seems to be an afterthought rather that an
> integral feature of the language.

Actually, it is a very well thought out feature of the language.  In 
Java, the finalizer is run when the object is eligible for garbage 
collection.  But within the finalizer, you can create a new reference to 
the object and make it ineligible for collection.

In Ruby, the finalizer is not run until *after* the object is collected. 
Since the object itself is no longer around, there is no possibility of 
even accidently creating a new reference to the object.  It also means 
that the finalizer can't be an instance method (because the instance is 
gone when the finalizer is run).

> Another thing I find very surprising for a language having such a rich
> OO model is the lack of static constructors (available in C# and somehow
> in Java) and static destructors (something I always wanted to have in
> Java/C#).

How would you use static constructors/destructors?  Perhaps we can show 
you Ruby equivalents.

--
-- Jim Weirich

-- 
Posted via http://www.ruby-forum.com/.