On Wed, 18 Oct 2000, Yukihiro Matsumoto wrote: > local. By the way, what do you think about the for-loop variable, > which is syntactically block parameter without blocks. > > For example, > > index = 345 > for index in 1..5 > print "#{index}\n" > end > print index # Prints 5 > > is almost identical to > > index = 345 > (1..5).each do |index| > print "#{index}\n" > end > print index # Prints 5 > > except the former does NOT introduce any block scope. If this is made clear in the manual -- that *no* new scope is introduced -- then I'd suggest that present behaviour remain the same. But the 1.4 manual said: for Examples: for i in [1, 2, 3] print i*2, "\n" end Syntax: for lhs... in expr [do] expr.. end Executes body for each element in the result of expression. for is the syntax sugar for: (expr).each `{' `|' lhs..`|' expr.. `}' Which rather suggests new scope *is* created... I would advocate the simplest (in terms of number of different cases) rules of scope possible, and that block parameters should have scope for that block only. Principle of least to remember? :-) > > matz. > Hugh hgs / dmu.ac.uk