From: "David A. Black" Date: 2009-01-12T00:38:10+09:00 Subject: Re: How Ruby Hi -- On Sun, 11 Jan 2009, Mike Stephens wrote: > The variable scope rules, >>> for example, do seem to be conceived by someone with a sadistic turn of >>> mind. >> >> Which rules are you thinking of? > > Just one example is 5.4.3 in The Ruby Programming Language (Flanagan & > Matsumoto). This talks about whether a variable is private to a block > but it depends on this, that and the other. Oh, those rules :-) The good news is that the rules are pretty well-tailored to the actual programming needs you're like to have, which include wanting to write closures (so that the block captures the local variables from the scope of its creation) and having variables that are truly local to the block. It might be sadistic to disallow either of those scenarios :-) It's been a thorny area, though, and it's undergone a lot of change between 1.8 and 1.9. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) http://www.wishsight.com => Independent, social wishlist management!