From: Rick DeNatale Date: 2008-09-21T02:30:08+09:00 Subject: Re: why one array continues to grow after repeated call ------=_Part_56860_26012141.1221932284493 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, Sep 18, 2008 at 2:52 PM, Brian Candler wrote: > > > (So, at first glance, c is automatically something like a pointer. I > > guess in Ruby terms, that's what is called an alias.) > > They're called "references", to distinguish them from pointers because > you can't actually use them as pointers (e.g. you can't "increment" the > pointer to point to the next area of memory, as you can in C). > They are also called references (actually MRI uses the term value, but that's probably confusing), because they don't HAVE to be pointers. To some extent it's implementation dependent. MRI does use pointers for most object references, but some object references are encoded directly. In MRI, this happens for things like Fixnums, nil, true, and false. The implementation detects these since the low-order bit of the reference value is set, which can be used because all objects which are referenced by pointers need to have an even address. I hint at this in the referenced article. The exact implementation of references/values depends on the particular implementation of Ruby, so it's best to just think of references as opaque 'tokens' which map 1-1 with object instances. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ ------=_Part_56860_26012141.1221932284493--