matz / zetabits.com (Yukihiro Matsumoto) writes:


[...]

> |In my opinion, this is super-dirty, and by far something you don't expect
> |from your program. I don't know any language that would allow this kind of
> |thing? Fortunately, this is not allowed in current Ruby...
> 
> Could you tell me how dirty it is?  Although I know it's kinda dirty.

It's a bit hard to explain, that's why I said "in my opinion". I think it
has to cope with the fact that the programmer will use explicit sub block
(either by {} or by begin/end) while explicitly local variables will be
'declared' (that is, first used, with the assignment operator) inside the
block and still be valid when the block exits.

That's why I asked you if you think of this new behaviour as: we'll use <>
99% of the time, and || when we know we want to export the variables
outside the block.

 
> Non shadowing, flat local variable scoping, that it tries to emulate
> is, in my opinion, not dirty at all.  The dirty part lies in flatness

I think this clashes with the Ruby principle of the least surprise, with
the automatic implicit exporting of the scope. This said, it could be a
useful and efficient technique; though, I think programmers don't expect
such behaviour. That's why the keyword "exprt" once proposed could be of
use.

> depending on context, to achieve compatibility.

I'm not sure I get what you mean by depending on context.




-- 
Guillaume Cottenceau - http://mandrakesoft.com/~gc/