On 27.07.2007 11:22, Phlip wrote: > Robert Klemme wrote: > >> I think "pass by reference" is not the proper term because that would >> imply that you could change a variable in the calling scope, i.e. you >> could do >> >> def magic(x) x = 10 end >> foo = 1 >> puts foo # prints 1 >> magic(foo) >> puts foo # prints 10 >> >> which you can't. > > Working backwards from your example, that is the definition of an "immediate > value". Violent agreement achieved! I'm not sure where you see the agreement and also I don't see how the piece above makes for a definition of an immediate value. Did I miss a smiley somewhere? An immediate value is something that does not live on the heap but where the reference is the value. Other than that it behaves the same as any other object. Immediate values are just an interpreter internal optimization - you wouldn't notice if that was abandoned and Fixnums became ordinary instances like others (apart from performance of course). The example presented by me does not work - regardless whether you use a Fixnum, an Array or some other object. This has only to do with the parameter passing mode. Kind regards robert