I believe ruby uses it internally to track the objects. If you change or
remove the object_id, then nothing will be referencing that object and the
garbage collector will eat it up. All this is heresay though, until someone
confirms it.

Allen Madsen
http://www.allenmadsen.com


On Tue, Dec 29, 2009 at 1:00 PM, ColinDKelley <[email protected]>wrote:

> On Dec 28, 7:27 am, Matt Jones <[email protected]> wrote:
> > Wandering ever-more-offtopic, but does anybody know exactly why Ruby
> > 1.9 whines when removing object_id? It warns that doing so "may cause
> > serious problem", but I've never seen a discussion of exactly *what*
> > problem. I noted (on the above ticket) that AssociationProxy and Scope
> > carefully avoid undefining object_id, but is that solely because of
> > the warning?
>
> Yes, we've all been wondering what the risk is there.  Worst case I
> guess we could grep through the Ruby source I suppose.
>
> Tom Locke on the Hobo project wondered
>
> > OTOH maybe it's like crossing the [streams] in Ghostbusters: you just
> don't do it and you don't ask why : )
>
> I've never been a fan of superstition though.  Doesn't that just lead
> to a "cargo cult?" :-)
>
> I wondered if maybe Object#equal? used object_id to determine if the
> two objects were the same.  But that theory was disproven by a test
> that undef'd it first: equal? ran just fine. I even tried def'ing
> equal? to raise an exception and that showed it never got invoked by
> equal? anyway.
>
> -Colin
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-core%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.


Reply via email to