On 9/30/07, Charles Oliver Nutter <charles.nutter / sun.com> wrote:
> Austin Ziegler wrote:
>> No, I don't think that's a valid comparison because a void* still
>> takes up space -- it's a location -- in C++. That is, I can
>> legitimately do:
>>
>>   void* a = &5;
>>   void* b = &a;
>>
>> It's *important* for people to understand deeply that Ruby variables
>> take up no space -- they're labels. If I call something a cat and you
>> call that same something 'Fluffy', we're still referring to the same
>> animal, but neither of our names for that animal can easily be
>> referred to by another name.
>>
>> Ruby variables are "wafer-thin". They're, as I said, just sticky notes
>> that can be moved around at will. It's the *objects* that take up the
>> space.
> Ruby variables take up just as much space, they just do it in the call
> stack rather than on the heap.

That's an implementer's view. When I program with Ruby, I don't think of
a variable taking up space. In purely Ruby terms, a variable isn't an
object that I can manipulate. In C++ terms, I can manipulate a variable
because it's a concrete item.

> Ruby variables hold the value of an object reference. If you re-assign
> them, you are setting them to a different object reference. If you
> retrieve them, you're getting an object reference which you can then
> pass by value or use to invoke methods.

Conceptually, they're better seen as labels or sticky notes. Maybe not
for the implementers, but definitely at the normal programmer's level.
Thinking about them more than that is just asking for madness because
you can't interact with them at any other level than that.

-austin
-- 
Austin Ziegler * halostatue / gmail.com * http://www.halostatue.ca/
               * austin / halostatue.ca * http://www.halostatue.ca/feed/
               * austin / zieglers.ca