On Jan 8, 2007, at 7:06 PM, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ ruby-Bugs-7680 ] a block argument within a block > which argument has the same name leaks" > on Tue, 9 Jan 2007 11:57:56 +0900, dblack / wobblini.net writes: > > |It's an interesting case, and I can definitely see that it > wouldn't be > |easy to implement. What about just not having the warning? Mostly > |people wanted block-locals so that they could stop worrying about the > |names. So maybe it isn't necessary for the compiler to warn. > > Using in-block variable outside is the biggest source of my mistakes > in Ruby. I'd like to address this issue in the future. Until then, > it will warn to reduce my headache. I agree they need work. Why not go back to the rubyconf 2005 proposal? I believe it was to allow new vars created in a block to be normal local variables (not dvars). I've discussed the expected behavior of local variables in ruby to new users and this is what they expect. The other expected behavior is that block arguments are seen to all code 'below' the block and not to any code above.. For example: a = [1,2] a.each do |i| m = "hello" i.upto(10) do |j| n = "evan" # i, j, n, m are seen here. end # j is NOT seen here. # i, m and n are seen here. end # i and j are not NOT seen here. # m and n are seen here. Thoughts? > > matz. >