From: "David A. Black" Date: 2005-09-29T02:24:07+09:00 Subject: Re: creating independent lambdas in loops Hi -- On Thu, 29 Sep 2005, Eric Mahurin wrote: > --- "David A. Black" wrote: >> On Thu, 29 Sep 2005, Eric Mahurin wrote: >> >>> It still seems like there should be a way to control >> variable >>> locality in blocks better. Making the variable local just >>> based on whether the variable already exists in the outer >> scope >>> doesn't cut it. >> >> It's never bothered me to view block variable assignment as >> assignment to existing variables, but I know I'm in a small >> minority >> which, among other things, does not include Matz :-) You can >> expect >> this to change in Ruby 2.0. > > Any idea what the planned change is going to be? New construct > like: > > localize(:a,:b) {...} Hopefully nothing quite that obviously "added as an afterthought to the language" :-) > Or maybe an incompatible change like making all block arguments > local no matter what. See http://www.rubyist.net/~matz/slides/rc2003/mgp00010.html and the slides following that one. I think the idea would be: a = 1 method_call {|a| a = 2; b = 3 } puts a # 1 puts b # 3 > It would be nice if all definite changes were put on rcrchive > and marked as accepted. And somehow put the potential changes > in there too. Or is there another place where this information > is held? That's really not what RCRchive is for; it's for the processing by Matz of change requests from other people. I think discussion of possible changes coming from Matz is spread around -- Matz's blog, ruby-core, here, the TODO file, etc. David -- David A. Black dblack@wobblini.net