From: gwtmp01@... Date: 2006-03-02T07:16:36+09:00 Subject: Re: Teaching Ruby to COBOL programmers On Mar 1, 2006, at 2:32 AM, Joel VanderWerf wrote: > Anyway, variables *do* hold some kinds of values, like numbers, > booleans, and symbols, in almost exactly the way that C variables > "hold" > values. Ironically, the only thing that ruby variables hold *is* > VALUE, > as it is called in the source. > Well, not everyone conceptualizes numbers, booleans and symbols as immediate values. It is hard to explain the following if you think of fixnums as immediate values: 13.instance_variable_set('@note', 'bad luck') 13.instance_variable_get('@note') # => 'bad luck' You can wrap that in a method if you want: class Fixnum attr_accessor :note end x = 99 x.note = 'bottles of beer on the wall' x.note # => 'bottles of beer on the wall' Seems like x holds a reference to an object and not an immediate value. Assignment semantics are often where the 'immediate' vs. 'reference' issue comes up, especially with literals: a = b # usually described as reference copy c = 10 # usually described as storing an immediate value d = c # lots of hand waving ensues IMHO it is much easier to just think of fixnums and booleans and symbols as objects and their respective literal representations as references to those same objects. Gary Wright