From: Dominik Bathon Date: 2006-01-04T05:59:26+09:00 Subject: Re: Implicit block parameter? On Tue, 03 Jan 2006 19:39:48 +0100, wrote: > Hi -- > > On Wed, 4 Jan 2006, Ross Bamford wrote: > >> [[1,2,3],[2,3,4],[3,4,5]].each { it.select { it % 2 == 0 } } >> >> (I've not tested that btw but you get the idea). However I guess with >> that it's also potentially confusing when using the implicit idea, >> since it has the same magic variable meaning two different things in >> the same line. I guess in this case I'd probably declare the argument >> in the select block anyway (as 'i' or something). > > That's actually another good argument against "it": you'd be trampling > the outer it with the inner it. And having to remember to declare the > inner argument to protect it from this really puts the whole thing in > the "added to the language as an afterthought" category. With the patch I sent the outer "it" is not "overwritten" by the inner "it", because it's a global function and not a variable and it always returns the first argument of the current block (if none was given it returns nil). And for the other point: if it gets to complicated, just don't use "it" and declare the argument(s). Dominik