From: Brian Candler Date: 2003-02-01T21:59:21+09:00 Subject: Re: Local variables & blocks > (guess no one read my other message on this) I did. I'm just not really qualified to comment. But I will anyway :-) It always seemed strange to me that 'local variables' were not really part of an object, and therefore seemed to break the OO model. I think what you are proposing is to turn them into a special sort of instance variable: so x = 1 is a bit like @x = 1 except that the second case persists with the object for its entire lifetime, whereas the first case persists only until the end of, erm, I'm not quite sure - the current lexical scope? Perhaps then a new lexical scope create a temporary subclass where these instance variables are deposited? All method calls (including instances of local variables) will then follow the normal chain of calling back up to the parent. I'm not sure how this differs from the current situation though, if you replace "temporary subclass" with "stack frame". I suppose it might make local variables more widely available - for example: class Foo def bar puts i end def baz i = 10 bar end end Foo.new.baz # doesn't work now would allow the value of 'i' to be seen in 'bar' when called from 'baz'. If that were desirable though, I'd have thought the current implementation could allow it (e.g. by searching through all the stack frames, not just the current one) Regards, Brian.