From: Daniel Schierbeck Date: 2006-05-19T00:34:50+09:00 Subject: Re: Rescue clauses on do/end blocks? Ross Bamford wrote: > On Thu, 2006-05-18 at 23:55 +0900, Daniel Schierbeck wrote: >> I know this has been on the table before, but I really see no reason not >> to allow do/end blocks to have rescue clauses on them, i.e. >> >> foo do >> bar >> rescue >> baz >> end > > Just playing Devil's Advocate, what'd happen with this: > > File.open('somefile') do |f| > puts f.read > end rescue puts "Can't open" The same as there would now; since the rescue clause is not inside the do/end block, it is not affected by this proposal. The difference would be that your version would also rescue exceptions raised by File.open, while the proposed syntax would only rescue exceptions raised within the block given to File.open. But I like the devil's advocate approach, it makes the proposals sharper :) Daniel