Hi -- On Thu, 30 Jan 2003, Yukihiro Matsumoto wrote: > It does. The key is: > > * no other way to make block local variables > > So that x in > > a.each do |item| > x = ... > end > p x > > would not be a block local variable. The code above will work without > preceding "nil" assignment. I know I'm joining this thread rather late, but I have a minority opinion anyway, so it may not matter :-) I'm one of the few people who have never been bothered by the way things are now. But I realize it's going to change, so that's OK. However, the above example, where x comes into being in the block and then persists, looks and feels very strange to me. I suspect that if this is adopted, it won't be long before it starts showing up in lists of "Ruby Gotchas" and such. For me, part of the problem is just the visual backwardness of it -- having something propagate from a right-hand field back into a left-hand field, which has a "shoe on wrong foot" feel to me. But more fundamentally, I've lost sight of what problem people are perceiving and trying to solve. Originally, the problem was shadowing. As I understood it, the reason this was a problem: def meth(arr) x = 0 arr.each {|x| ... } p x # arr[-1] end was that people wanted to be able to write blocks, and move them around the code physically, without worrying about what came before and after them. The need to do refactoring without renaming variables has been mentioned in this connection. OK.... That's a good argument for having |x| be local to the block. But then if we're also trying to accomodate this: def meth(arr) arr.each {|x| y = x } p y end we're now focusing on having blocks work in such a way that they *do* interact with what's around them. And if one argues that the block *and* the "p y" could be moved around together during refactoring -- well, so could "y = nil", etc.... In other words, I'm perceiving different philosophies about what and why all of this is needed, and I'm not sure how (or whether) they can all be accomodated. David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav