[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Writing a destructor is possible ?

Guillaume Nargeot

3/1/2007 1:59:00 AM

I would like to know if it is possible to write (for a class) something like
a destructor (like you do with C++), or something equivalent.
If it is not possible, how can I do to perform some operations on the
deletion of my object ?
4 Answers

Austin Ziegler

3/1/2007 2:44:00 AM

0

On 2/28/07, Guillaume Nargeot
<guillaume.nargeotDONOTFUCKINGSPAM@fusionsystems.co.jp> wrote:
> I would like to know if it is possible to write (for a class) something like
> a destructor (like you do with C++), or something equivalent.
> If it is not possible, how can I do to perform some operations on the
> deletion of my object ?

Please look in the archives; this was just discussed last week.

In short, you can write a finalizer, but you'll never use it because
it may not be called. If you must release resources when your object
is destroyed, ensure that you provide a block form (like File.open).

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca

Guillaume Nargeot

3/1/2007 5:43:00 AM

0

> Please look in the archives; this was just discussed last week.
>
> In short, you can write a finalizer, but you'll never use it because
> it may not be called. If you must release resources when your object
> is destroyed, ensure that you provide a block form (like File.open).
>
> -austin

Sorry, but I don't know were to find these archives... I thought I found
them on the internet, but I didn't find anything into them by searching
for "destructor" or "finalizer". Even by filtering this newsgroup topics
with these words I can't find anything since the 2007-02-16.

Can you tell me where I can find this discussion please ?

Eric Hodel

3/1/2007 8:16:00 AM

0

On Feb 28, 2007, at 22:11, Guillaume Nargeot wrote:
>> Please look in the archives; this was just discussed last week.
>>
>> In short, you can write a finalizer, but you'll never use it because
>> it may not be called. If you must release resources when your object
>> is destroyed, ensure that you provide a block form (like File.open).
>>
>> -austin
>
> Sorry, but I don't know were to find these archives... I thought I
> found
> them on the internet, but I didn't find anything into them by
> searching
> for "destructor" or "finalizer". Even by filtering this newsgroup
> topics
> with these words I can't find anything since the 2007-02-16.
>
> Can you tell me where I can find this discussion please ?

http://blade.nagaokaut.ac.jp/ruby/ruby-talk/i...

(google "ruby-talk archives")

Stephane Wirtel

3/1/2007 8:50:00 AM

0

Guillaume Nargeot wrote:
>> Please look in the archives; this was just discussed last week.
>>
>> In short, you can write a finalizer, but you'll never use it because
>> it may not be called. If you must release resources when your object
>> is destroyed, ensure that you provide a block form (like File.open).
>>
>> -austin
>
> Sorry, but I don't know were to find these archives... I thought I found
> them on the internet, but I didn't find anything into them by searching
> for "destructor" or "finalizer". Even by filtering this newsgroup topics
> with these words I can't find anything since the 2007-02-16.
>
> Can you tell me where I can find this discussion please ?
With google,

ObjectSpace.define_finalize