Hello --

On Wed, 15 Nov 2000, Yukihiro Matsumoto wrote:

> Hi,
> 
> In message "[ruby-talk:6372] Re: rescue clause affecting IO loop behavior"
>     on 00/11/15, Dave Thomas <Dave / thomases.com> writes:
> 
> |Is this a feature with a good reason, or just some side effect of the
> |parse? To be honest, it seems to violate POLS.
> 
> I made this on purpose.  The decision was made years ago.  I think I
> wanted to distinguish `begin' for grouping and `begin' for exception
> handling.  OK, let's discuss together.
> 
> 							matz.

Maybe it's just because I was not expecting the current behavior, and
therefore saw it in a somewhat negative light when I discovered it...
but I tend to think that a begin/end block should behave the same way,
with regard to its modifiers, whether it contains a rescue clause or
not.  Or, if an exception-handling begin/end block is really a
different thing from a regular begin/end block, then perhaps the
modifiers should be illegal.  The thing that is confusing, in my view,
is to allow the modifiers but not have the whole thing behave in the
expected "expression-modifier-boolean" way.

Going back to the syntax in question:

  begin
    <stuff>
  rescue
    <...>
  end until <condition>

For one thing, it hurts readability if the condition gets tested
before the block is executed.  It means one has to scan for rescue
clauses, and work out their scope, before one knows what "until
<condition>" actually means.  Similarly, one cannot stick in a rescue
clause (perhaps for testing), or replace an if-else construct with a
rescue clause, without reviewing and possibly changing the syntax of
the block.

If the above syntax were illegal (i.e., if exception-handling blocks
really had to end with "end"), that would force the wrapping in an
outer block in cases where a modifier was desired, while ensuring
that the modifier would then work the same way in every case.


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav