Ross Bamford ha scritto: > Hi, > > Probably this has been considered before, but I'll ask anyway. > > Before I used Ruby, I used Groovy. In some ways they are (well, were > anyway) quite similar, and one feature that I found cool in Groovy that > I often miss in Ruby is the implicit (/default/whatever?) block > parameter, 'it': > > [1,2,3].each { puts it } > > AFAIR this was only provided when no 'it' existed in scope, and the > block had a single argument passed when none were declared. Maybe this > would interfere with Ruby's warnings about block parameter mismatch, or > maybe the implementation doesn't allow for it, but I just wondered if > it might be possible, because I notice I do: > > [1,2,3].each { |it| puts it } > > and it bugs me a little bit :D eh, I alwaya thought the same. And I just discovered that "it" is used in at least another environment: AliceML seem to use it to mean "the result of the last expression", similarly to how we use "_" in irb. Isn't it nice to write x= 2+2 print it ;)