From: Daniel DeLorme Date: 2008-09-30T23:46:06+09:00 Subject: Re: ruby1.9 block scope David A. Black wrote: > > On Tue, 30 Sep 2008, Yukihiro Matsumoto wrote: > >> The reason I haven't introduced it yet in Ruby is that single >> assignment after the blocks can change the scope of a variable >> afterward. Same thing happens assignments _before_ the blocks >> already. But I hesitated to enhance that far. > > Please continue to hesitate :-) That would be very hard to deal with. > As a reader of the code, you'd have to do a two-pass visual scan > before you could begin to understand any of it. And you would have to > do that for *every* block, just in case, even if only 1% of them had a > variable defined later. You dont need a two-pass visual scan; it just allows you to assume that a variable defined a line L of a method will be available for reference at line L+n, no matter if it was defined inside a block or not. It should be common sense, really. -- Daniel