[#6363] Re: rescue clause affecting IO loop behavior — ts <decoux@...>

>>>>> "D" == David Alan Black <dblack@candle.superlink.net> writes:

17 messages 2000/11/14
[#6367] Re: rescue clause affecting IO loop behavior — David Alan Black <dblack@...> 2000/11/14

Hello again --

[#6582] best way to interleaf arrays? — David Alan Black <dblack@...>

Hello --

15 messages 2000/11/26

[#6646] RE: Array Intersect (&) question — Aleksi Niemel<aleksi.niemela@...>

Ross asked something about widely known and largely ignored language (on

23 messages 2000/11/29
[#6652] RE: Array Intersect (&) question — rpmohn@... (Ross Mohn) 2000/11/29

aleksi.niemela@cinnober.com (Aleksi Niemel) wrote in

[#6723] Re: Array Intersect (&) question — Mathieu Bouchard <matju@...> 2000/12/01

> >Use a hash. Here's code to do both and more. It assumes that

[#6656] printing/accessing arrays and hashes — raja@... (Raja S.)

I'm coming to Ruby with a Python & Common Lisp background.

24 messages 2000/11/30

[ruby-talk:6367] Re: rescue clause affecting IO loop behavior

From: David Alan Black <dblack@...>
Date: 2000-11-14 19:09:52 UTC
List: ruby-talk #6367
Hello again --

On Wed, 15 Nov 2000, ts wrote:

> >>>>> "D" == David Alan Black <dblack@candle.superlink.net> 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



In This Thread