From: Robert Klemme Date: 2007-06-04T04:45:28+09:00 Subject: Re: Introducing the "it" keyword On 03.06.2007 19:34, Eleanor McHugh wrote: > On 2 Jun 2007, at 01:09, Chad Perrin wrote: >> On Fri, Jun 01, 2007 at 10:45:33PM +0900, Jacob Burkhart wrote: >>> >>> return it if with:it(v+1) < 10 >>> >>> Would be translated by the interpreter into exactly the same thing as >>> this: >>> >>> with:it(v+1) do >>> return it if it < 10 >>> end >>> >>> which is exactly the same thing as this: >>> >>> with(v+1) do |it| >>> return it if it < 10 >>> end >> >> Yes . . . I was just pointing out that, of those, the third is the only >> one that really seems particularly readable to me in a Ruby context. >> >> Something about with:it(v+1) just doesn't look very readable to me. It >> might have something to do with the lack of space separating tokens, but >> I'm pretty sure that's not all there is to it. > > I tend to agree, although that's because I'd really like Ruby to have > the 'with' syntactic sugar that VB has. I also much prefer the idea of > being able to choose my own block variable name rather than being stuck > with 'it' which to my eye is an ungainly word. It still bothers me > though that a formulation that's intended to make for a simple atomic > statement would now cover three lines onscreen... I believe Ruby does not have "with" because there is instance_eval - it's more to type but can be easily aliased and has the same effect - rebinding "self". (I know that some talk about another "with", that rebinds arbitrary variable names. But I believe the original idea of "with" was, that you could invoke methods without explicit receiver). Kind regards robert