From: "David A. Black" Date: 2007-09-29T16:11:00+09:00 Subject: Re: a different type of reference (shocked) Hi -- On Sat, 29 Sep 2007, Phlip wrote: > SpringFlowers AutumnMoon wrote: > >> (and in Ruby, we call a method by "pass by value, the value being the >> reference (pointer) to an object). and when the method returns >> something, it returns a value, which is the reference to an object.) It >> is very consistent all the way. In Ruby, we don't have the "alias >> reference", right? > > In Ruby, types that can (generally) fit into 32 bits are "immediate > types". These Fixnums and Floats are pass-by-value. All other types - > from String up - are pass by reference: I'd describe it more as SpringFlowers did: pass by value, where the value happens to be a reference. When you do this: s = "string" do_something(s) you are passing s by its value, which is a reference to the string object. David -- Upcoming training from Ruby Power and Light, LLC: * Intro to Ruby on Rails, Edison, NJ, October 23-26 * Advancing with Rails, Edison, NJ, November 6-9 Both taught by David A. Black. See http://www.rubypal.com for more info!