On Wed, Aug 12, 2009 at 10:25 PM, Ruby on
Rails<[email protected]> wrote:
>
> Thanks Fred ,
>
>  I am not getting that concept of ruby . We have nil.object_id is 4
> ,are they fix for every value, i am not sure for this .

No, not in general, and the real story is rather dependent on the
particular Ruby implementation.

If we are talking the MRI (or Matz' Ruby Implementation) then there
are a few objects like nil, true, false... with fixed object_ids, also
FixedNum instances have an object_id which can be computed from their
value.

In general though the object_id is typically related to the address of
the object in memory, so you can't rely on any fixed mapping based on
value, in fact, the object_id which is the identity of the object has
to be independent of the state for a mutable object.

-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to