Hi -- On Tue, 7 Aug 2007, Gary Wright wrote: > On Jul 25, 2007, at 4:43 PM, dblack / wobblini.net wrote: >> I think it's useful to >> know that you're passing references around: >> >> a = "abc" >> b = a >> b << "def" >> a # "abcdef" >> >> vs. immediate values (symbols, integers), though of course it does all >> indeed converge on objects. >> > > I go even farther and simply think of symbols and integers to also be > references. Within that context, the literal 1 is simply a textual > representation of a reference to the object that behaves like the integer 1. > The fact that the Ruby interpreter doesn't actually allocate memory for > the object itself is just an implementation detail. I'd agree about the literal 1 in comparison with other literals: 1 # textual representation of that object "hi" # textual representation of that object [1,2,3] # etc. but if you do this: a = 1 b = "hi" now a (as I understand it) is actually bound to the integer 1, while b is bound to a reference to the object. (I can't say "A reference to 'hi'" since that 'hi' would be a different one.... :-) The reason I think it can be good to keep that difference in view is that it has some explanatory power -- especially when the question arises about why there's no a++ (which, because a *is* 1, would be like 1++). David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)