From: Jim Weirich Date: 2005-01-20T04:34:48+09:00 Subject: Re: value by reference trans. said: > Personally, I've alwasy thought of variables as containters, A perfectly good way to think of variables in FORTRAN, Ada, Pascal, Eiffel, C, C++, C#, Java, FORTH and Algol. In these languages variables are containers into which you put values (I call this the shoebox model of variables). However, it is misleading in Python, Lisp, Scheme and, of course, Ruby. In these languages, thinking of assignment as binding (associating) a name to a value is more productive in that you can reason about the language purely in terms of objects and names associated with objects. No need to introduce the concept of references. And the difference between immediate objects and reference objects (almost[1]) melts away. For more thoughts on this, see: http://onestepback.org/index.cgi/Tech/Ruby/Shoeboxes.rdoc. For an example of "breaking" the rules and re-introducing references in the mix, see: http://onestepback.org/index.cgi/Tech/Ruby/RubyBindings.rdoc. -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) [1] Almost, but not quite. Immediate objects still can't have singleton methods.