From: Matt Armstrong Date: 2001-07-10T11:01:13+09:00 Subject: [ruby-talk:17582] Re: Constants and Variables Albert Wagner writes: > On Monday 09 July 2001 11:40, you wrote: > >> One of the other things I miss dearly is a way to create a new >> block-local variable. I have been bitten by >> >> foo = 42 >> bar.each { |foo| foo.doSomething(); } >> ...foo is no longer 42 >> >> which would have been avoided by defining the second foo as block >> local -- by the way, it is a formal parameter for the block, why >> does it even think about touching the foo from outside the block? >> This looks so wrong to me. > > Me too. But for some reason I have yet to fathom, no one else here > agrees. I think most people agree that it is certainly a FAQ and something people starting out with Ruby hit their heads against. The subject comes up frequently on this list, and most of the arguments have been hashed over many times before. This is probably why the regular posters tend to ignore the threads now. :-) Last I remember, Matz was considering alternative syntax that would create a block local variable.