From: Chad Perrin Date: 2007-06-01T03:39:20+09:00 Subject: Re: Introducing the "it" keyword On Thu, May 31, 2007 at 10:21:49PM +0900, Mariusz P??kala wrote: > On 2007-05-31 21:32:28 +0900 (Thu, May), Jacob Burkhart wrote: > > consider the clarity of reading these: > > > > with(v+1) do |a| > > with(x+2) do |b| > > return a if a+b < 10 > > end > > end > > > > vs. > > > > with:a(v+1) do > > with:b(x+2) do > > return a if a+b < 10 > > end > > end > > > with:var could be usefull in other scenrios as well, yes? > > Maybe that's just my twisted brain, but I find the first example more > readable :-) It's not just yours -- mine, too. If you wanted to locate the parameter label in the same place as the expression, I'd say do something more like this: let a = v + 1 in let b = x + 2 in return a if a + b < 10 end end Of course, that might require more language-mangling, so overall I'd be more inclined to use the first "with" example, which just looks like a block. Perhaps something like this could be done (where I don't presume to know what to call the method): (v + 1).foo do |a| (x + 2).foo do |b| return a if a + b < 10 end end With that syntax, you'd have a more traditional-looking lead-in to your block. Of course, I might find the with:a(v+1) syntax more readable if it were used in a language where that sort of thing was normal. It just looks un-Rubylike enough to me that it throws me off in a Ruby context. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Dr. Ron Paul: "Liberty has meaning only if we still believe in it when terrible things happen and a false government security blanket beckons."