From: Austin Ziegler Date: 2007-10-01T22:04:03+09:00 Subject: Re: a = Dog.new # a is not a pointer and not a reference? On 10/1/07, 7stud -- wrote: > Austin Ziegler wrote: > > 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. > Your original post was ridiculous and now you've been called out. Take > your medicine with some semblance of grace. Back pedaling as fast as > you can stirs up a cloud of dust, but we still know its you in there. Are you always this unpleasant, boorish, and rude? Tell me: do you really care that a Ruby variable takes up space? You, as a programmer, shouldn't. Can you do a damned thing about it? Nope. In the end, it doesn't matter. Charles is *technically* correct from the implementer's perspective. Gary Wright has provided the only valid complaint, that I ignore scope. Well, yes, I did. On purpose. I considered how to address it and decided it was better to ignore it for the concept. From a Ruby programmer's perspective, it is important to understand that a variable is a label -- a name -- for an object, and that the name is transferable and is always transferred on assignment (of which a special form is argument setting in method passing). It has as much permanence as a hastily scribbled note about an object that you're dealing with. Anyone telling you anything else is either (a) an implementer who has to care about the inner details or (b) confused. (BTW, understanding variables this way also helps demystify Symbols immensely, and there's a lot of confusion about Symbols because people want to think that they're some magic juju.) -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca