From: Robert Klemme Date: 2011-04-18T20:16:53+09:00 Subject: Re: [ANN] To Yield or Not to Yield: An Inferable Question On Mon, Apr 18, 2011 at 11:46 AM, Michael Edgar wrote: > It is the correct link, we had some unscheduled downtime. My apologies. Give it > a couple minutes for the unicorns to kick in. Now I see it. Thanks! This looks interesting and I think this is something to muse about further. On first glance I only noticed the complete absence of another case of "optional block" apart from calls guarded by block_given? or tests for &b parameter to be non nil: caught exceptions irb(main):003:0> def foo irb(main):004:1> yield irb(main):005:1> rescue LocalJumpError irb(main):006:1> end => nil irb(main):007:0> foo => nil irb(main):008:0> foo { puts "called" } called => nil irb(main):009:0> LocalJumpError.ancestors => [LocalJumpError, StandardError, Exception, Object, Kernel, BasicObject] irb(main):010:0> def bar; yield rescue LocalJumpError;end => nil irb(main):011:0> bar => LocalJumpError irb(main):012:0> bar { puts "called" } called => nil That will also be tricky since there are multiple exceptions that can be caught to make the failed call "disappear" plus you can have arbitrary nesting of begin - rescue - end blocks which can depend on each other in bad ways (although these are more on the side of pathological code). Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/