From: Austin Ziegler Date: 2007-09-30T22:43:49+09:00 Subject: Re: a = Dog.new # a is not a pointer and not a reference? On 9/29/07, Joel VanderWerf wrote: > > A Ruby variable is nothing like a C++ variable. Never has been, never > > will be. > It's not so mysterious. If you're coming from C/C++, you may find it > helpful to think of a ruby variable as a C void* variable. Assigning > between variables in ruby is just like C assignment between two void* vars. 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. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca