Hi --

On Sun, 6 Oct 2002, Massimiliano Mirra wrote:

> On Sun, Oct 06, 2002 at 09:19:25AM +0900, Nikodemus Siivola wrote:
> > The current behaviour may cause newcomers some surpirises,
>
> May I ask, surprises to whom?
>
> Java doesn't let you do this at all:
>
>     int foo = 3;
>     if (true) {
>         int foo = 4;
>
> Maybe C++ folks?

The arguments I've heard for having block-local variables in Ruby
more or less resolve into three:

1. it's done in other languages (aka, people might be surprised by
   not having them);
2. not having them makes it risky to cut-and-paste code blocks from
   one section of a program to another;
3. Matz thinks he should have done it in the first place.

#3 is the one that stops me from agitating too strongly against it :-)
My main qualms about the whole thing come from the way the extra
punctuation (in the many solutions talked about) looks, as well as the
question of how problematic the underlying problem is.  I guess my
inclination would just be to say, "Ruby code blocks don't have
block-local variables.  How unusual.  Now, back to programming" :-)


David

-- 
David Alan Black                      | Register for RubyConf 2002!
home: dblack / candle.superlink.net     | November 1-3
work: blackdav / shu.edu                | Seattle, WA, USA
Web:  http://pirate.shu.edu/~blackdav | http://www.rubyconf.com