From: Trans Date: 2007-05-26T02:07:20+09:00 Subject: Re: Introducing the "it" keyword On May 24, 11:55 pm, Greg Fodor wrote: > > While we're at it I have another use for "it" I'd appreciate very > > much. An (it)erator reference. > > Wow. Yes! Only issue I see is nested blocks though. > (Which it is "it?" :)) Spose it could through a warning if 'it' > comes into scope twice. > > But this would be cool: > > my_strings.map { pluralize it }.filter { it =~ /tests/ }.each { p it } > > The less silly variable names we have to come up with, the better! I would say that it would always belong to the current block. If you need "it" from the parent block it's easy enough to assign a variable to it. However, I wasn't intending that 'it' reference the block arguments, but the iteration itself, with useful methods about the state of iteration, eg. it.first?, it.last?, it.even?, it.odd?, it.index. Of course this could also include it.value. T.