Re: (Static) Constructors/Destructors in Ruby
- From: Marcin Mielżyński <lopexx@xxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 20:37:43 +0200
PrimaryKey wrote:
Hello!
After reading the Pickaxe book I noticed it provides almost no
information about object lifecycle and no mention of destructors. As a
Java/C# guy my gut reaction was: Wouldn’t it be nice to have a
“unintialize” method to be called when the object is being destroyed?
Java does not have destructors either. finalize method is not guaranteed to be called
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#).
Ruby has them. Every class definition is an executable code (public, private, protected are methods) so you can alternate method definitions with arbitrary code (in fact, this is much more powerful mechanism than static blocks in Java and static constructors in C#)
lopex
.
- References:
- (Static) Constructors/Destructors in Ruby
- From: PrimaryKey
- (Static) Constructors/Destructors in Ruby
- Prev by Date: Setting the Return-Path in TMail?
- Next by Date: Re: unpack signed short in network (big-endian) byte order
- Previous by thread: (Static) Constructors/Destructors in Ruby
- Next by thread: Re: (Static) Constructors/Destructors in Ruby
- Index(es):
Relevant Pages
|