From: David Alan Black Date: 2000-11-15T04:09:52+09:00 Subject: [ruby-talk:6367] Re: rescue clause affecting IO loop behavior Hello again -- On Wed, 15 Nov 2000, ts wrote: > >>>>> "D" == David Alan Black writes: > > > You don't have the same 'begin' > > D> begin > D> puts "Line from first block." > D> end until true > > With this 'begin' ruby don't test the first time. This mean that the block > is always executed once > > D> begin > D> puts "Line from second block." > D> rescue > D> d = "dummy exception handler" > D> end until true > > Here for ruby you don't have a block 'begin' but a block 'rescue'. This > mean that ruby will make the test before trying to enter in the block > 'rescue' I see what you mean, at least as far as the behavior goes. But I don't see any evidence of such a thing as a rescue block in the reference manual (1.4.6) -- only optional rescue clauses, which occur inside begin/end blocks. "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 :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav