From: Robert Klemme Date: 2007-11-16T01:57:18+09:00 Subject: Re: Shadowing bug?? 2007/11/14, Vasco Andrade e Silva : > tho_mica_l wrote: > > This is a somewhat similar situation where a variable isn't all that > > local: > > > > x = 1 > > (2..3).each {|x|} > > p x > > => 3 > Exactly! > > > > > I think this is intended though and AFAIK this behaviour is subject > > to > > change in 2.0 and maybe has already changed in 1.9. > > I tested in ruby1.9 and the "bug" seems fixed: > > RUBY_VERSION > "1.9.0" > > x = 1 > > (2..3).each {|x|} > > p x > 1 > > > f_ko({:xpto => "ohoh"}) > :in_lambda > "ohoh" > {:xpto=>"ohoh"} > "ohoh" > {:xpto=>"ohoh"} # :-) Just let me add that even though this is fixed IMHO it is a bad idea to use the same identifier in both cases if you want to keep them separate. This can likely cause confusion. Kind regards robert -- use.inject do |as, often| as.you_can - without end