From: Daniel Brockman Date: 2005-06-29T11:21:25+09:00 Subject: Re: yield does not take a block Yukihiro Matsumoto writes: > If you have shown me the reason "yield &bar" is not strange (and is > useful) other than consistency, I'd be glad to apply the Nobu's > patch in [ruby-talk:146636]. I don't have any other reason than consistency. Having used Ruby 1.8 up until yesterday, yield and Proc.new.call are equivalent in my mind. It seems I will have to drop that identification when moving to 1.9. The fact that blocks cannot take blocks pre-1.9 has always bugged me, and I certainly don't think there's anything strange about this code: define_method :foo do |*args, &block| ... end However, I agree that most uses of these metablocks (if you will) probably do not coincide with the use cases of the yield keyword. So I will not be upset if Nobu's patch is not applied. I will just make a mental note that Yield Does Not Take a Block and move on. Should I ever be tempted to pass a block to yield, I will remember that it doesn't work, and simply call the block explicitly instead. I guess the reason why yield &block is not strange to me is that the yield statement yields values, and blocks are just special values. -- Daniel Brockman