[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Object IDs

Alex Young

7/11/2006 2:10:00 PM

A couple of quick questions:

a) Are object id's ever reused within the life of a Ruby process?

b) Are object id's unique across the whole Ruby process, or only within
a given context?

--
Alex

6 Answers

Yukihiro Matsumoto

7/11/2006 2:24:00 PM

0

Hi,

In message "Re: Object IDs"
on Tue, 11 Jul 2006 23:10:15 +0900, Alex Young <alex@blackkettle.org> writes:

|a) Are object id's ever reused within the life of a Ruby process?

They are recycled by garbage collector.

|b) Are object id's unique across the whole Ruby process, or only within
|a given context?

They are unique in the certain point of the execution.

matz.

Guillaume Marcais

7/11/2006 2:32:00 PM

0


Le 11 juil. 06, à 10:10, Alex Young a écrit :

> A couple of quick questions:
>
> a) Are object id's ever reused within the life of a Ruby process?

I believe that Object#equal? compares ids if not overridden.

>
> b) Are object id's unique across the whole Ruby process, or only
> within a given context?

Unique across the process.

Guillaume.

>
> --
> Alex
>
>


Alex Young

7/11/2006 2:41:00 PM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: Object IDs"
> on Tue, 11 Jul 2006 23:10:15 +0900, Alex Young <alex@blackkettle.org> writes:
>
> |a) Are object id's ever reused within the life of a Ruby process?
>
> They are recycled by garbage collector.
Thanks... That explains a minor oddness I'm seeing. Are they recycled
before the finalizers are called?

> |b) Are object id's unique across the whole Ruby process, or only within
> |a given context?
>
> They are unique in the certain point of the execution.
I thought they would be, just wanted to be sure :-)

Thanks,
--
Alex

Ara.T.Howard

7/11/2006 2:42:00 PM

0

Yukihiro Matsumoto

7/12/2006 12:25:00 AM

0

Hi,

In message "Re: Object IDs"
on Tue, 11 Jul 2006 23:41:11 +0900, Alex Young <alex@blackkettle.org> writes:

|Thanks... That explains a minor oddness I'm seeing. Are they recycled
|before the finalizers are called?

No. Finalizers are called before the recycling.

matz.

Alex Young

7/12/2006 2:17:00 PM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: Object IDs"
> on Tue, 11 Jul 2006 23:41:11 +0900, Alex Young <alex@blackkettle.org> writes:
>
> |Thanks... That explains a minor oddness I'm seeing. Are they recycled
> |before the finalizers are called?
>
> No. Finalizers are called before the recycling.
>
> matz.
Great. Thanks for confirming that.

--
Alex