On 9/18/07, Gary Wright <gwtmp01 / mac.com> wrote:

> With respect to "primitive types" and Ruby, it isn't necessary
> to make exception for these types with respect to assignment
> semantics.  All variables hold object references and assignment
> is always in terms of references. This is true for all objects
> (including symbols, fixnums, true/false/nil).

True. In the case of immediate value objects (i.e. fixnums,
true/false/nil), the 'reference', what the MRI implementation refers
to as the C type definition value, is actually an encoding of the
unique value.

The format of value references  to symbols has varied from
implementation version to implementation version.
>
> The only thing special about Ruby's 'primitive' classes is that they
> behave such that identity is isomorphic to equality.  That is to
> say that a.equal?(b) if and only iff (a == b).

Actually that's not really special, it's true of any object which
hasn't overriden Object#==

For example, consider:

   a  = Object.new

At first glance this might appear to be a pretty worthless object, but
its unique identity can be useful.  For example, it can be used to
mark an unused element in a collection when nil is not considered an
unused value.


-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/