From: Paul Brannan Date: 2007-09-04T22:28:02+09:00 Subject: Re: with On Tue, Sep 04, 2007 at 06:50:43AM +0900, Matthias W?chter wrote: > > Anyway, I do wonder whether all this can be nicely solved by using local > > variables. Basically #with does nothing else than binding a value to a > > local variable with limited scope. > > Ruby tries to avoid local variables wherever it can by chaining > iterators together like in file-open-each-line-gsub. I tried to allow > a block to be used for non-enumerable types as well. Ruby doesn't try to avoid local variables; this is something you have done. IMO it's not a good idea. If there's a bug anywhere in your chain and one of the methods you call returns the wrong type (nil, for example), then debugging becomes more difficult. Paul