Stephen White writes:

> The syntax change I proposed would fix that problem. Here's how it would
> look, the new way...

Yes, I understand that.  I just meant that I would be fine with simply
shadowing the block parameter and not changing the other scoping
rules.

One problem with that, and also with your proposal, is that sometimes
it is useful to be able to access the loop variable after the loop,
such as in

10.times {|i| if i == 5 then break end}

That's a trivial example, true, but by looking at i, you can tell if
the loop exited with a break and where.  This is a direct
counterexample to my desire to shadow i and make it safe, so I have to
think a bit more.

I still like having a "let x=1 in ... end" form, coupled with some way
to indicate that the block variable should or should not be shadowed,
but it does change things quite a bit.  It may clash a bit with the
rest of ruby; I'm not sure.


-- 
Johann Hibschman                           johann / physics.berkeley.edu