From: Ryan Davis Date: 2011-04-18T17:41:56+09:00 Subject: Re: To Yield or Not to Yield: An Inferable Question On Apr 17, 2011, at 14:40 , Michael Edgar wrote: > Hi Brian – Thanks for sharing your thoughts! Since much of what you note > is commonly accepted about Ruby, I am happy that my research is > subtle enough to warrant such discussion (and interesting enough to get > an e-mail or two!) > > If you don't mind, I'd like to write a blog post sharing your concerns > (anonymized, naturally) and my responses. Would that be okay? > >> Points I'd raise: >> >> 1. In my experience, very little real-world Ruby code uses >> 'block_given?'. If it needs to yield, it just yields. I'd consider this >> to be a case of duck-typing. > > This seems to suggest Rubyists rarely write methods that take blocks > optionally. Of this, I am highly skeptical. You should be highly skeptical. From our seattle.rb projects: % ack -l block_given? */dev/{lib,test} | wc -l 28 And from my gauntlet setup: % ls | wc -l 20245 % find ~/.gauntlet -type f | xargs zgrep -l block_given? | wc -l 4715 So roughly 1 in 4 gems in my gauntlet downloads use block_given? I think that makes it clear that your work can provide a lot of insight.