From: Dave Thomas Date: 2000-11-15T04:20:42+09:00 Subject: [ruby-talk:6368] Re: rescue clause affecting IO loop behavior David Alan Black writes: > "Programming Ruby" also does not indicate that a begin/end block should act any > differently because it has one or more rescue clauses. In discussing while/until > modifiers, it says: > > [given this: expression until boolean-expression] > If expression is a begin/end block, the block will always be executed at least one time > > and elsewhere: "Exceptions may be handled within the scope of a begin/end block." > There's no indication that putting a rescue clause in, or taking one out, will affect > the basic behavior of blocks (including begin...end until boolean). > > I sort of hope it turns out to be a (fixable) problem in Ruby, rather than a > problem in the docs :-) So do I ;-) To be honest, I hadn't come across this behavior in the past. Something else missing from the book is the fact that method definitions are treated as begin/rescue/end blocks: def fred open("xsdsd", "r") rescue puts "Failed to open" ensure puts "Got here" end fred => Failed to open Got here This one kind of snuck up on us, and we didn't have time to add it before printing. "If it's on paper, it's out of date" Dave