From: Kristof Bastiaensen Date: 2004-05-01T19:59:01+09:00 Subject: Re: def [](v) xx; return yy; end # returned value is ignored !? On Sat, 01 May 2004 15:28:05 +0900, Jean-Hugues ROBERT wrote: >>> - Reference, a reference is an indirect mean of access to a lvalue's >>> value that is dereferenced when the value is needed and that also makes >>> it possible to assign a value to the lvalue at any time. There is a problem with treating an lvalue this way, and that is that not every lvalue is an storage location. In fact only variables as an lvalue are storage locations, the other ones are methods (i.e.: a[]=5 means a.[]=(5), a.foo=bar calls the method foo=(bar) on a). I wouldn't welcome the introduction of references on Ruby, because it may mess things up. Let's say the method "alter" takes a reference, and changes the value. Then calling alter(a) will change the value of a, but this is not obvious when invoking this method, or look at the code. It may be interesting to be able to access variables indirectly using binding() (outside eval). for example: a = 2 binding().local_get(:a) => a == 2 binding().local_set!(:a, 5) => a == 5 And also Binding::ivar_set!, Binding::ivar_get and Binding::get_self