From: Johann Hibschman Date: 2001-05-05T13:11:24+09:00 Subject: [ruby-talk:14700] Re: to be local or not to be local [was Re: Arggg Bitten by the block var scope feature!!!] In article <9cvidg$tb0$1@flotsam.uits.indiana.edu>, Raja S. wrote: > Thanks for your interesting example of how having block params be non-local > can be useful. Still, I would say, > > >last_i, last_obj = nil, nil > >data_objects.each_with_index {|obj, i| > > last_i, last_obj = i, obj > > if ... > >} > > is a safer/cleaner option. (In this particular case also I might have used > catch/throw rather than a 'break' from the block.) But, of course, it boils > down to a personal preference. Well, to be honest, I agree with you. I'd prefer if it were the other way around, and if I'm given the option to declare local variables with "" or some similar syntax, I would use it far more often that not. I'm just afraid that such a change would be to disruptive to be pragmatic. --Johann