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
and even
foo do
bar
rescue
baz
ensure
bur
end
These would be equivalent to
foo do
begin
bar
rescue
baz
ensure
bur
end
end
When an ensure clause is added, the expression evaluated therein will
always be the return value of a call to the block -- just as if there
was a begin/end block inside the do/end block.
This wouldn't offer any new functionality, but would make the use of
rescue and ensure clauses more consistent -- currently they work with
begin, class, and def blocks (more?).
There's of course the case of the curly bracket block syntax, but I see
no need to support it there -- I think it's most commonly used with
one-liners, where rescuing may be overkill.
I'd like some feedback, and if its generally positive, I'll post an RCR.
Cheers,
Daniel