SpringFlowers AutumnMoon wrote: > Charles Oliver Nutter wrote: > >> 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. > > yes, that's what i mean by thinking of a reference to an object as a > pointer. let's say if we implement Ruby, can't we actually set it as a > pointer to the Dog object, and then whenever we use d.bark(), it will go > to where it points to and start looking for a table of method names. > and if not found, go to the parents, again using a pointer to the parent > class. i won't increment the pointer or do pointer arithmetic, and i > won't care what the pointer's value is (the address) and won't tell the > programmer, but underneath, it is still a pointer. I think the named slots holding object references analogy is probably as accurate as you can get without getting into implementation specifics. For example, in Ruby, the named slots *arg* pointers to objects (except in a few cases like Fixnums). In JRuby, they're just Java references, again passed-by-value object references. But named slots will apply fairly well across all implementations. - Charlie