From: Dennis Decker Jensen Date: 2001-03-07T19:10:04+09:00 Subject: [ruby-talk:12223] Re: FEATURE REQUEST: 'my' local variables "Leo Razoumov" wrote in message news:ja6bsredzit.fsf@balu.qualcomm.com... > On the other hand in some cases one wants to be able to create a local variable > in the inner block even though a variable with the same name already exists in > one of the enclosing scopes. > > # PROPOSED FEATURE: > x = 0 #line_1 > { > my x = 7 # new varible 'x' shadowing 'x' from line_1 > x # -> 7 > } > x # -> 0 > > > I guess it should not be hard to add this functionality to the language. > Any thoughts? I don't find that an improvement. On the contrary. To me it seems like a bad excuse for the ability of bad naming. It's error and bug prone. It's not very intention revealing and slows down readability significantly. If you absolutely must, then I find Bryn's suggestion in [ruby-talk:12214] a decent compromise. Dennis Decker Jensen