From: gga Date: 2007-01-20T21:45:06+09:00 Subject: Re: local variable assertion dflanagan@gmail.com wrote: > > This actually breaks the second-use case for my method. If the block > expects parameters, then I want my method to return the block so that > it can be passed on to the calling method. Ah, I see. Sorry, I did not catch that from your docs. It is indeed an ugly construct. I'm not sure trying to save a block is a smart move. You end up with a method that behaves and returns something very differently just based on a block's arity. That's just a huge headache waiting to happen. I mean.... if you are really concerned about the efficiency of this: local(:x) { data.each { |x| x*x } } I'd say you are definitively guilty of premature optimization. > > I believe this would actually print 'never run'. Since x is not a > local variable, its use in the first block remains local to that block. > Correct, actually. I seemed to have forgotten the x = 0 before the begin block. Sorry. PS. Welcome to the Ruby community. Looking forward to see what you'll do with ruby.